+ Start a Discussion
Dannilo FrancoDannilo Franco 

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

I'm getting the same error even though I'm using the code provided by other users here. The new field is also created.
 
trigger AccountAddressTrigger on Account (before insert, before update) {
    for(Account a : Trigger.new){
        If (a.Match_Billing_Address__c == true) {
            a.ShippingPostalCode = a.BillingPostalCode;
        }   
    }
}

Is there anything wrong with it? 

Thanks in advance.
Best Answer chosen by Dannilo Franco
Dannilo FrancoDannilo Franco
Hey Sumit,

I just fixed the problem! For some reason the Trigger was inactive. I actived it and checked the Challenged and worked properly!

Best,

Dannilo

All Answers

Sumit Kumar Singh 9Sumit Kumar Singh 9
Hello Dannilo,

Can you pls tell me what error you are getting. It's working fine in my dev account.


Thanks, 
Sumit Kumar Singh
Dannilo FrancoDannilo Franco
Hi Sumit,

I'm getting the following error:

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

I created the Match Billing Address property and I rewrote my code like suggested in other posts but I'm still getting this error.

Any ideas? Can it be my dev account?

Thanks,

Dannilo
Dannilo FrancoDannilo Franco
Hey Sumit,

I just fixed the problem! For some reason the Trigger was inactive. I actived it and checked the Challenged and worked properly!

Best,

Dannilo
This was selected as the best answer
HK2SFDCHK2SFDC
trigger AccountAddressTrigger on Account (before insert, before update) {
    for(Account a : Trigger.new){
/* from below if statement (a.BillingPostalCode != null)  checks "if an Account has a Billing Postal Code" from challenge
           if(a.BillingPostalCode != null && a.Match_Billing_Address__c == true){
                a.ShippingPostalCode  = a.BillingPostalCode;
            }
    }
}
tonante27tonante27
The way the problem description was worded it seems like we have to also create an if statement to check if the Billing Postal Code was valid (i.e.not empty)  as well as checking the Match field. So I still got the problem wrong by using something vey close to the solution that HK2SFDC provided. t was not until I removed the check for Null Billing Postal Code was my solution accepted.