2

I think i misunderstood validation rules, so i answered the following challenge creating a validation rule that only applies if the insertion is different for what i write in the rule:

AND(ISBLANK( Account.Id ),
OR( MailingPostalCode = Account.ShippingPostalCode ))

I mean, if the insertion/update is correct, then do it, else display error message.

The challenge has succeeded.

My question is, am i wrong or i should write in the validation rule the conditions where should'nt be accepted?

Here is the challenge

1

According to the challenge

  • 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 saved.

  • 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)

the correct approach will be as follows:

AND(NOT(ISBLANK(Account.Id)) 
, NOT(ISBLANK(MailingPostalCode)) 
, NOT(ISBLANK(Account.ShippingPostalCode))
, (MailingPostalCode != Account.ShippingPostalCode)
)

Since, you need to check all the blank entries for Account's Id, ShippingPostalCode and Contact's MailingPostalCode and then validate if Contact's MailingPostalCode != Account.ShippingPostalCode

| improve this answer | |
1

The correct validation rule for the mentioned challenge is

AND(
    NOT(ISBLANK( AccountId )),
    MailingPostalCode  <>  Account.ShippingPostalCode
)

Validation rule should check for the conditions that should'nt be accepted.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.