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
AMOL KRISHNA SAHA KAPASIAAMOL KRISHNA SAHA KAPASIA 

How to create a trigger to copy billing address values from account to contact shipping address whenever an account is created

AnkaiahAnkaiah (Salesforce Developers) 
Hi,

whenever contact is created then you need to copy the billing address values  to shipping address ? Am i correct.

Thanks!!
@anilbathula@@anilbathula@
Hi Amol,

Check this link : https://salesforce.stackexchange.com/questions/328689/if-contact-is-created-without-a-mailing-address-copy-related-account-address

Thanks
Anil.B
SOURAV GUHA 9SOURAV GUHA 9
trigger updateContactAddress on Account (after insert) {
    
    list<contact> contactList= new list<contact>();
    for (Account acc: trigger.new)
    {
        Contact c= new contact();
        c.AccountId= acc.ID;
        c.Shipping_Address__c= acc.BillingCity + ' ' + acc.BillingCountry + '  ' + acc.BillingState +  ' ' + acc.BillingPostalCode;
        c.LastName=acc.Name + ' '+ 'contact';
        contactList.add(c);
    }
insert contactList;
}