You need to sign in to do that
Don't have an account?

i have an error Variable does not exist: Match_Billing_Address__c at line 3 column 15
trigger AccountAddressTrigger on Account(Before insert,before update) {
for(Account a : Trigger.new){
If (a.Match_Billing_Address__c == true && a.BillingPostalCode!=Null) {
a.ShippingPostalCode = a.BillingPostalCode;
}
}
}
for(Account a : Trigger.new){
If (a.Match_Billing_Address__c == true && a.BillingPostalCode!=Null) {
a.ShippingPostalCode = a.BillingPostalCode;
}
}
}
Check if 'Match_Billing_Address__c' field is existing on account?
Thanks,
Vinay Kumar
Please mark as Best Answer if above information was helpful.
Thanks,
Thanks,
Thank,
Thanks,
I hope you are doing well. Firstly, you need to head to setup mode. Select Accounts from object manager. Click on fields&relationships. Create a checkbox named Match Billing Address. Leave the checkbox unchecked. After that, you need to write your trigger.
The trigger is as follows:
trigger AccountAddressTrigger on Account (before insert, before update) {
for (Account a: Trigger.New) {
if(a.Match_Billing_Address__c == True) {
a.BillingPostalCode = a.ShippingPostalCode;
}
}
}
Once you save it, you can do some testing on the application and verify that it is working. When you populate just the shipping postal code field and check the match billing address, and save the record, you will see that the billing postal code would also be populated with the same postal code.
Hope this helps!