• Mark Erdeljac
  • NEWBIE
  • 15 Points
  • Member since 2015
  • Allegheny College


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I was working on the Getting Started with Apex Triggers and my code doesn't seem to be working, could someone please, help me find the error. I have stared at it for awhile and can't seem to figure out where my mistake is, any help that can be provided would be greatly appreciated, thank you in advance for your help and cooperation.

trigger AccountAddressTrigger on Account (before insert, before update) {
    for (Account a : [SELECT BillingPostalCode, ShippingPostalCode FROM Account WHERE BillingPostalCode != null AND Match_Billing_Address__c = TRUE AND Id IN :Trigger.New]) {
        a.ShippingPostalCode = a.BillingPostalCode;
    }
}

And my error is: Challenge not yet complete... here's what's wrong: 
Setting 'Match_Billing_Address__c' to true did not update the records as expected.
I was working on the Getting Started with Apex Triggers and my code doesn't seem to be working, could someone please, help me find the error. I have stared at it for awhile and can't seem to figure out where my mistake is, any help that can be provided would be greatly appreciated, thank you in advance for your help and cooperation.

trigger AccountAddressTrigger on Account (before insert, before update) {
    for (Account a : [SELECT BillingPostalCode, ShippingPostalCode FROM Account WHERE BillingPostalCode != null AND Match_Billing_Address__c = TRUE AND Id IN :Trigger.New]) {
        a.ShippingPostalCode = a.BillingPostalCode;
    }
}

And my error is: Challenge not yet complete... here's what's wrong: 
Setting 'Match_Billing_Address__c' to true did not update the records as expected.