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

issue with create validation rules challenge
Hello,
For below challenge,
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)
I create validation rule as below.
Rule Name: Contact_must_be_in_Account_ZIP_Code Active [Checked]
Error Condition Formula: IF( AND(NOT( ISBLANK( AccountId )) ,NOT(ISBLANK( MailingPostalCode ))) , IF( MailingPostalCode = Account.ShippingPostalCode , false, true) , false)
Error Message: Contact must be in Account ZIP Code Error Location: Mailing Zip/Postal Code
Description: Contact must be in Account ZIP Code
trailhead check challenge is giving below error.
Challenge not yet complete... here's what's wrong:
The validation rule failed to enforce the business logic
can some one help on finding the solution.
thanks in advance.
For below challenge,
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)
I create validation rule as below.
Rule Name: Contact_must_be_in_Account_ZIP_Code Active [Checked]
Error Condition Formula: IF( AND(NOT( ISBLANK( AccountId )) ,NOT(ISBLANK( MailingPostalCode ))) , IF( MailingPostalCode = Account.ShippingPostalCode , false, true) , false)
Error Message: Contact must be in Account ZIP Code Error Location: Mailing Zip/Postal Code
Description: Contact must be in Account ZIP Code
trailhead check challenge is giving below error.
Challenge not yet complete... here's what's wrong:
The validation rule failed to enforce the business logic
can some one help on finding the solution.
thanks in advance.
Please try below code:-
Please mark this as solution if this will help you.
Thanks,
Amit Chaudhary
Yes you are right for the same i have used the NOT(ISBLANK(AccountId)) in formula.
Please mark ths above Solution as best answer if that will help you. So that is some one has same issue above post can help others.
Thanks
Amit Chaudhary
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
)