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
Nagaraju Mogili 7Nagaraju Mogili 7 

Triggers Challenge ==== I was unable to complete the task, could anyone please help me to clear this challenge..

Challenge Not yet complete... here's what's wrong: 
Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true.
Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field.
For this challenge, you need to create a trigger that, before insert or update, checks for a checkbox, and if the checkbox field is true, sets the Shipping Postal Code (whose API name is ShippingPostalCode) to be the same as the Billing Postal Code (BillingPostalCode).
The Apex trigger must be called 'AccountAddressTrigger'.
The Account object will need a new custom checkbox that should have the Field Label 'Match Billing Address' and Field Name of 'Match_Billing_Address'. The resulting API Name should be 'Match_Billing_Address__c'.
With 'AccountAddressTrigger' active, if an Account has a Billing Postal Code and 'Match_Billing_Address__c' is true, the record should have the Shipping Postal Code set to match on insert or update.
Check challenge
Here is My code :---

trigger AccountAddressTrigger on Account (before insert, before update) {
    for(Schema.Account a{
        if(a.match_billing_address__C == true && a.billingpostalcode !=Null){
               a.BillingPostalCode = a.ShippingPostalCode ;
Devanshu soodDevanshu sood
trigger AccountAddressTrigger on Account (before insert, before update) {

    for(Account a :{
        If (a.Match_Billing_Address__c == true) {
            a.ShippingPostalCode = a.BillingPostalCode;


Please mark it as best answer if the information is that question is removed from an unanswered question and appear as a proper solution.

Devanshu sood
Thank you Devanshu sood
Suraj Tripathi 47Suraj Tripathi 47
Hi Nagaraju,

"You can also try this will help you to complete your challenge"
trigger AccountAddressTrigger1 on Account (before insert,before update) {


If you find your Solution then mark this as the best answer. 

Thank you!

Suraj Tripathi