You need to sign in to do that
Don't have an account?
Vikram Singh 157
Hi ! Here is a trigger when a custom checkbox is checked , copy billing address to shipping address
trigger CopyBillingAddtoShpAdd on Account (before insert, before update) {
for( Account ACC : trigger.new){
if(Check_Billing_as_Shipping__c == True){
ACC.BillingStreet = ACC.ShippingStreet;
ACC.BillingCity = ACC.ShippingCity;
ACC.BillingZip/Postal Code = ACC.ShippingZip/Postal Code;
ACC.BillingCountry = ACC.ShippingCountry;
}
}
}
for( Account ACC : trigger.new){
if(Check_Billing_as_Shipping__c == True){
ACC.BillingStreet = ACC.ShippingStreet;
ACC.BillingCity = ACC.ShippingCity;
ACC.BillingZip/Postal Code = ACC.ShippingZip/Postal Code;
ACC.BillingCountry = ACC.ShippingCountry;
}
}
}
Sorry i was updating shipping from billing
Now i have update right code for this trigger
Make this as best anwer if it is working.
Thanks,
varun
All Answers
here you are doing mistake
ACC.BillingZip/Postal Code = ACC.ShippingZip/Postal Code;
correct postal address filed is ACC.BillingPostalCode = ACC.ShippingPostalCode ;
I Hope its helpful,Please select my anser as best answer.
Sorry i was updating shipping from billing
Now i have update right code for this trigger
Make this as best anwer if it is working.
Thanks,
varun