• roopak mudili
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Delete failed. First exception on row 0 with id 0013600000LcVd3AAF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Cannot delete account with related opportunities.: []

Go this error while working on the first challenge under Apex Triggers in Developer Beginner Trailhead.

Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field.

And my solution for the same is as follows:

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


}

 
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Delete failed. First exception on row 0 with id 0013600000LcVd3AAF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Cannot delete account with related opportunities.: []

Go this error while working on the first challenge under Apex Triggers in Developer Beginner Trailhead.

Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field.

And my solution for the same is as follows:

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


}