+ Start a Discussion
srikanth vykuntapusrikanth vykuntapu 

validation rule from trail head

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)

this is the validation code, its working for me when i checked it back but when i am checking challenge its not accepting ans showing me the error the validation rule failed to enforce business logic.
AND( NOT( ISBLANK( MailingPostalCode )), NOT( ISBLANK(AccountId)),   if(MailingPostalCode <> Account.ShippingPostalCode  , True, False))

can any one suggest me the right code or can you correct it.

You don't require to check isBLANK for the MailingPostcode because if the account shipping postal code is null, then it will throw your validation error message, even though contact has account and contact mailing postal code is also null and account shipping postal code also null.
Sachin Chaudhary 15Sachin Chaudhary 15

Hey srikanth,

I have completed this challenge by this error condition formula "Account.ShippingPostalCode  <>  MailingPostalCode"
Try it :-)


Rupal KumarRupal Kumar
hi srikanth,

I have completed this challenge by this-
Try this-
  AND( ISBLANK(MailingPostalCode),(Account.ShippingPostalCode != MailingPostalCode) )

Rupal Kumar.
lakshmi choday 6lakshmi choday 6
I have completed this challange by this
Try this:
AND(NOT( ISBLANK( Name ) ), BillingPostalCode  
<>ShippingPostalCode )