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
MIDHUN G REDDYMIDHUN G REDDY 

APEX TRIGGER TRAILHEAD

User-added image
My Trigger code:

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;
        }   
    }

}

Please guide me where i make a Mistake..

Thanks
Midhun
 
Best Answer chosen by MIDHUN G REDDY
Chandra Sekhar CH N VChandra Sekhar CH N V
Its a small syntax mistake in your condition, Try the below code: 
trigger AccountAddressTrigger on Account (before insert,before update) {
   
    for(Account a:Trigger.new){
        if((a.BillingPostalCode!=null) && (a.Match_Billing_Address__c ==true)){
            a.ShippingPostalCode = a.BillingPostalCode;
        }
    }
   }