You need to sign in to do that
Don't have an account?

Please help with creating a Validation rule.
A scenario on Trailhead:
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)
How to do it..as i tried multiple ways..i am surely missing on something. Please help
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)
How to do it..as i tried multiple ways..i am surely missing on something. Please help
try this onces
AND( NOT( ISBLANK( AccountId ) ), MailingPostalCode <> Account.ShippingPostalCode )
Thanks
the same error coming with Account Id
Also clear why to use AccountId and not Account name.
Thanks a lot.
AND(
ISNEW(),
NOT(ISBLANK( AccountId )),
MailingPostalCode != Account.ShippingPostalCode
)
In Salesforce, any contact object that is associated with an account object will have that account name and ID stored within it.
its show Account Name but actually it's used accountId field for it so we use AccountId here insted of accountName in our formula
I hop it's helps you
Thanks
Mark it best Answer if it helps you so it make proper solution for others :)