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
MMuneeeMMuneee 

Trigger getting error

//update shipping address with billing address

trigger afterinsertbillingstreet on Account (After insert) {
    list<Account> li;
    for(Account a:trigger.new)
    {
        a.ShippingCity=a.BillingCity;
        a.ShippingCountry=a.BillingCountry;
        a.ShippingLatitude=a.BillingLatitude;
        a.ShippingLongitude=a.BillingLongitude;
        a.ShippingPostalCode=a.ShippingPostalCode;
        a.ShippingState=a.BillingState;
        a.ShippingStreet=a.ShippingStreet;
       // li.add(a);
    }
//update li;
}
Deepak Kumar ShyoranDeepak Kumar Shyoran
What error you are getting on. Is that error comes with Update ?
PratikPratik (Salesforce Developers) 
Hi Muneendar,

What error are you facing?

Thanks,
Pratik
PratikPratik (Salesforce Developers) 
Hi Muneendar,

Try using before insert & before update event in your above trigge, it shold work.

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
PratikPratik (Salesforce Developers) 

Hi Muneendar,,

The field names should be:
ShippingCity, ShippingCountry, ShippingState, ShippingStreet, ShippingPostalCode and accordingly the Billing fields.


a.ShippingCity=a.BillingCity;
        a.ShippingCountry=a.BillingCountry;
        a.ShippingLatitude=a.BillingLatitude;
        a.ShippingLongitude=a.BillingLongitude;
        a.ShippingPostalCode=a.BillingPostalCode;
        a.ShippingState=a.BillingState;
        a.ShippingStreet=a.BillingStreet;

Hope this will help you.

Thanks,
Pratik