trigger AccountAddressTrigger on Account (before insert, before update) {
For (Account a : Trigger.new) {
If (a.Match_Billing_Address__c=true) {
system.debug(a.Match_Billing_Address__c);
a.ShippingPostalCode=a.BillingPostalCode;
}
}
}
1 answer
It should have been:
if(a.Match_Billing_Addtess__c == true)
What you were doing - and this will explain the "stranger problem" - was setting that checkbox to true ("=" assigns a value, "==" evaluates equality) which then caused the IF statement to evaluate to TRUE.