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
Boudewijn TimmersBoudewijn Timmers 

Creating validation rules not passing

Hi,
I am working on the trailhead Dev Beginner, but get stuck in the Creating Validation Rules Section. I get the error: "Challenge Not yet complete... here's what's wrong: The validation rule failed to enforce the business logic". I am an experienced coder (HTML, php, pascal etc) so I might think i have the logic correct. Still I keep getting these errors. Any known issues with this challenge? I made these assumptions:
- the rule should be on the Contacts object
- to verify if there is an associated account, I am validating if AccountId is not blank.
User-added image
 
Best Answer chosen by Boudewijn Timmers
buggs sfdcbuggs sfdc
HI Boudewijn Timmers,

Everything looks fine but please try to select the insert field option when you are writing "Error condition formula",please try the below condition it will clear your challange.
 
AND((MailingPostalCode <> Account.ShippingPostalCode),
    NOT(ISBLANK(Account.Id))
   )
Thanks,
Have a great day ahead!
Please mark it as correct answer,it may help others !
 

All Answers

Parker EdelmannParker Edelmann
Hello Boudewijn,

Your formula looks good. I'm not aware of any issue with this unit. You could try this similar code: NOT( ISBLANK( Account.Name ) ) && MailingPostalCode <> Account.ShippingPostalCode

I don't see any reason why the Trailhead check wouldn't like you code other than that you used AccountId instead of Account.Name.

I hope this works for you.

Regards,
Parker
buggs sfdcbuggs sfdc
HI Boudewijn Timmers,

Everything looks fine but please try to select the insert field option when you are writing "Error condition formula",please try the below condition it will clear your challange.
 
AND((MailingPostalCode <> Account.ShippingPostalCode),
    NOT(ISBLANK(Account.Id))
   )
Thanks,
Have a great day ahead!
Please mark it as correct answer,it may help others !
 
This was selected as the best answer
Boudewijn TimmersBoudewijn Timmers
This worked! However as you mentioned, I did indeed use the insert field option, but then the fields came in the formula with __c, which is appearantly incorrect?