You need to sign in to do that
Don't have an account?
![subramanyam karanamv subramanyam karanamv](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field
Hi All ,
I am facing the below error while trying to complete the Trial head challenge
Challenge : Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field
Error : Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true.
Thanks
K.VenkataSubramanyam
I am facing the below error while trying to complete the Trial head challenge
Challenge : Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field
Error : Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true.
Thanks
K.VenkataSubramanyam
Greetings to you!
Please try below code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Now i am getting the below error
Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true.
Regards
Subramanyam
Create a custom field: Setup-> Object Manager-> Account -> Fields and Relationships
Select New --> Field Type (Checkbox)
Enter Name as Match Billing Address
Checkbox should be Unchecked
Save.
Now write the below code, it is working without any errors
I hope it helps you!
* Please try below code it works fine:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
I have gone through your question. It giving an error because in your trigger you not check the condition Match_Billing_Address__c is True or not.
First thing is that you update your trigger.
Please use the code given below:-
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com