function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Todd AllmondTodd Allmond 

Help please. I cannot complete a trailhead hands on challenge. Admin Intermediate, Formulas & Validations, Create Validation Rules

I am having trouble completing the Hands On Challenge in Trailhead. It is in Admin Intermediate Trail, Section Formulas & Validations, Create Validation Rules Section. The instructions are below. Can someone please help? I have been stuck on this for a while now. I cannot seem to get the validation formula correct.

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 insertion of a 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 inserted.
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 ISBLANK function for this check)

Use this formula in validation rule, you will clear your trailhead
""AND(NOT(ISBLANK( AccountId ) ),MailingPostalCode <> Account.ShippingPostalCode)""


Select as best answer if it works for you


Todd AllmondTodd Allmond
Thank you very much! That did it and I understand why I should have done it that way.

Hi, Todd Allmond

your welcome, Would realy appreciate it if you could select it as best answer.

Jeffrey Wong 168Jeffrey Wong 168
Hi all, I created the below validation formula first:

NOT( ISBLANK( AccountName ) ),
(MailingPostalCode  <>  Account.ShippingPostalCode)
and tried creating a few new contacts and it worked as required, prompting errors if there is an associated account and postal code is different. But it did not passed the challenge becasuse the required formula is:
NOT( ISBLANK( AccountID ) ),
(MailingPostalCode  <>  Account.ShippingPostalCode)

I strongly believe that there are many ways to skin a cat and my formula should work and pass the challenge as well. As long as the formula includes any compulsory account's fields, such as Account ID, Account Name or Account Number etc, the validation formula should work as required.  What do you guys think?