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
David MeatsDavid Meats 

Creating Validation Rules : Keep receiving the following error on the challenge

I am a newbie at this and can not quite figure out why I am receiving the following error?

Challenge Not yet complete... here's what's wrong: 
The validation rule failed to enforce the business logic​


This is my answer :

ISBLANK(  AccountId  ) && (MailingPostalCode  =  Account.ShippingPostalCode)

This is the challenge:
  • 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
Best Answer chosen by David Meats
Amit Chaudhary 8Amit Chaudhary 8
Your validation rule should be like below
AND( 
NOT(ISBLANK(AccountId)), 
MailingPostalCode != Account.ShippingPostalCode 
)

User-added image

Let us know if this will help you


Thanks,
Amit Chaudhary

 

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Your validation rule should be like below
AND( 
NOT(ISBLANK(AccountId)), 
MailingPostalCode != Account.ShippingPostalCode 
)

User-added image

Let us know if this will help you


Thanks,
Amit Chaudhary

 
This was selected as the best answer
David MeatsDavid Meats
Thanks Amit,

That worked...