function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SalesforceAddictSalesforceAddict 

how can i create trigger on contact object where if change mailing address field or enter new mailing address in new contact then it automatically add on street adress field please help

Best Answer chosen by SalesforceAddict
sfdcMonkey.comsfdcMonkey.com
here is the sample trigger code : 
trigger updateAddress on Contact (before Insert,before update) {
   for(contact cc : trigger.new){
     // check if contact MailingStreet is not equal to null then update other field address
      if(cc.MailingStreet != null){
          cc.OtherStreet = cc.MailingStreet;
          // set other fields here in same way
      }
       
   }
}
Thanks let us know if it helps you 
 

All Answers

sfdcMonkey.comsfdcMonkey.com
hi Sachin can you please share your requrement in more details please.  ?

Thanks 
SalesforceAddictSalesforceAddict
1.sure bro i am asking that i want to create trigger on contact object
2.when i am insert or edit contact then if fill street adress
3. then it automatically same address should be in ( Other Address )field 
 
sfdcMonkey.comsfdcMonkey.com
here is the sample trigger code : 
trigger updateAddress on Contact (before Insert,before update) {
   for(contact cc : trigger.new){
     // check if contact MailingStreet is not equal to null then update other field address
      if(cc.MailingStreet != null){
          cc.OtherStreet = cc.MailingStreet;
          // set other fields here in same way
      }
       
   }
}
Thanks let us know if it helps you 
 
This was selected as the best answer
SalesforceAddictSalesforceAddict
thnx bro