Skip to main content
Hi

Plz need text class for below code plz

public  void offerMessage(List<WCT_Offer__c> newOffer){

    

     Map<String,String> offMsgMap = new Map<String,String>();

     Map<String,String> offLOIMap = new Map<String,String>();

     Map<String,String> offMsgMap1 = new Map<String,String>();

     Map<String,String> offLOIMap1 = new Map<String,String>();

     

     for(WCT_List_Of_Names__c LON:[Select Name,WCT_Type__c,WCT_Conditional_Verbiage__c, WCT_Message__c, WCT_LOI_Offer__c from WCT_List_Of_Names__c Where RecordTypeId=: WCT_Util.getRecordTypeIdByLabel('WCT_List_of_Names__c', 'Offer Message') AND WCT_Type__c= 'USI']){

        if(LON.WCT_Conditional_Verbiage__c<> null && LON.WCT_Message__c<> null && LON.WCT_Type__c <> null){

            if(!LON.WCT_LOI_Offer__c) {

                offMsgMap.put(LON.WCT_Conditional_Verbiage__c,LON.WCT_Message__c);

                

            } else {

                offLOIMap.put(LON.WCT_Conditional_Verbiage__c,LON.WCT_Message__c);

            } 

        }

     }

     for(WCT_Offer__c o:newOffer){

           if(o.Conditional_Verbiage__c <> null){

             if(!o.WCT_LOI_Offer__c) { 

                 if(offMsgMap.containsKey(o.Conditional_Verbiage__c)){

                      o.WCT_Message__c=offMsgMap.get(o.Conditional_Verbiage__c);

                 } else {

                      o.Conditional_Verbiage__c = 'Default';

                      o.WCT_Message__c=offMsgMap.get(o.Conditional_Verbiage__c);

                      

                 }    

             } else {

                 if(offLOIMap.containsKey(o.Conditional_Verbiage__c)){

                      o.WCT_Message__c=offLOIMap.get(o.Conditional_Verbiage__c);

                 } else {

                      o.Conditional_Verbiage__c = 'Default';

                      o.WCT_Message__c=offLOIMap.get(o.Conditional_Verbiage__c);

                 }                 

             }

         }

      }

     

     for(WCT_List_Of_Names__c LON:[Select Name,WCT_Type__c,WCT_Conditional_Verbiage__c, WCT_Message__c, WCT_LOI_Offer__c from WCT_List_Of_Names__c Where RecordTypeId=: WCT_Util.getRecordTypeIdByLabel('WCT_List_of_Names__c', 'Offer Message') AND WCT_Type__c= 'United States']){

        if(LON.WCT_Conditional_Verbiage__c<> null && LON.WCT_Message__c<> null && LON.WCT_Type__c <> null){

            if(!LON.WCT_LOI_Offer__c) {

                offMsgMap1.put(LON.WCT_Conditional_Verbiage__c,LON.WCT_Message__c);

                system.debug('This is the Uinted States'+offMsgMap1);

                system.debug('size1 is the'+offMsgMap1.size());

            } 

            else{

            

                offLOIMap1.put(LON.WCT_Conditional_Verbiage__c,LON.WCT_Message__c);    

                system.debug('size1 is the'+offLOIMap1.size());        

            }

         }

     }

     for(WCT_Offer__c o:newOffer){

         

         if(o.Conditional_Verbiage__c <> null){

             if(!o.WCT_LOI_Offer__c) { 

             

                 if(offMsgMap1.containsKey(o.Conditional_Verbiage__c)){

                      o.WCT_Message__c=offMsgMap1.get(o.Conditional_Verbiage__c);

                 } 

                 else{

                  o.Conditional_Verbiage__c = 'Default';

                  o.WCT_Message__c = offMsgMap1.get(o.Conditional_Verbiage__c); 

                 }

             }

                 else{

                 If(offLOIMap1.containsKey(o.Conditional_Verbiage__c)){

                    o.WCT_Message__c= offLOIMap1.get(o.Conditional_Verbiage__c);

                }

                

                else {

                      o.Conditional_Verbiage__c = 'Default';

                      o.WCT_Message__c= offLOIMap1.get(o.Conditional_Verbiage__c);

                }

            }            

        } 

  }

}

Thanks 

Raj *
1 个回答
  1. 2015年10月5日 09:32
    I assume you meant the test class for the code you have written. Did you happen to start writing the class? If not, I would suggest you to go through the help doc(http://www.sfdc99.com/2013/05/14/how-to-write-a-test-class/) and start coding - if you face any problems, the community can help you where you are stuck.

     
0/9000