Ads

Monday, 15 April 2013

Trigger for field update in Salesforce?

The below Apex code is used to update a field(Comments__c) in Member__c Object,

where Marital__Status and Comments__c are fields n Member__c object.

Code:

trigger commentsUpdate on Member__c (before Insert,before update) 

     for(Member__c member : Trigger.new)  
     {      
         if(member.Marital_Status__c != '')    
         {      
             member.Comments__c = member.Marital_Status__c;    
         }       
         else   
         {      
             member.Comments__c = 'No comments';    
         }       
     }  
}

1 comment:

  1. Plese see my blog and Check what is the problem in my blog adscence rejectd


    My Blog:freeatozinformation.blogspot.com

    ReplyDelete