Salesforce Trailhead Challenge: Create a validation rule to check that a contact is in the zip code of its account

Salesforce Trailhead Challenge

Create a validation rule to check that a contact is in the zip code of its account.
To complete this challenge, add a validation rule which will block the saving of a new or updated contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account’s shipping postal code (which has the API Name ShippingPostalCode).
  • Name the validation rule Contact must be in Account ZIP Code
  • A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be saved
  • The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANKfunction for this check)
 Error Condition Formula:

AND (

NOT(ISBLANK( AccountId )),

MailingPostalCode <> Account.ShippingPostalCode

)

Written by 

I am Sakthivel Madesh, a certified Salesforce Advanced Developer & Administrator working on Salesforce Technology since 2011. I am currently working in Techforce Services as Sr. Salesforce Developer. I have worked on multiple technologies Like PHP, Java, Salesforce, I am very passionate about Salesforce and to earn 14x Salesforce Certification. I love Trailhead for learning Salesforce Skill and Become a Trailhead 5x Ranger too. I Love to Learn & Share my Salesforce knowledge to Salesforce Learners/Beginner using My Blog and Salesforce Community.

Leave a Reply