You need to sign in to do that
Don't have an account?
Rachel_Natik
Trailhead Validation Rule Challenge Error
Hello,
I created the validation rule and checked that it worked in my org.
When I check it through trailhead, I get this error:
Challenge not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Zip Code does not match Account Shipping Zip Code: []
A different thread suggested deactivating the rule but when I do so I get this:
Challenge not yet complete... here's what's wrong:
The validation rule failed to enforce the business logic
For reference, this is the validation rule.
(NOT (ISBLANK(Account.Name))) && (MailingPostalCode <> Account.ShippingPostalCode)
Looks good and works well.
Any thought?
I created the validation rule and checked that it worked in my org.
When I check it through trailhead, I get this error:
Challenge not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Zip Code does not match Account Shipping Zip Code: []
A different thread suggested deactivating the rule but when I do so I get this:
Challenge not yet complete... here's what's wrong:
The validation rule failed to enforce the business logic
For reference, this is the validation rule.
(NOT (ISBLANK(Account.Name))) && (MailingPostalCode <> Account.ShippingPostalCode)
Looks good and works well.
Any thought?
AND((MailingPostalCode <> Account.ShippingPostalCode),
NOT(ISBLANK(Account.ShippingPostalCode)))
AND((MailingPostalCode <> Account.ShippingPostalCode), NOT(ISBLANK( Account.Name )))
AND((MailingPostalCode <> Account.ShippingPostalCode), NOT(ISBLANK( Account.Name )))
The difference I see between this one and the one you posted in your original email is that it uses the AND function rather than the conditional &&. Logically, I don't know why it would matter, but it must be something in the challenge vallidation logic.
IF(ISBLANK( Account.Id ), false, (IF(MailingPostalCode <> Account.ShippingPostalCode, true, false)))
Any advantage of using AND() functions over nested IFs?
Thanks
Sai Krishna tavva
best working anwser
AND( NOT(ISBLANK( Account.Name )) , MailingPostalCode <> Account.ShippingPostalCode )
AND( NOT(ISBLANK( Account.Name )) , MailingPostalCode <> Account.ShippingPostalCode )
I used Arvind's answer above and it worked fine:
I'm trying to understand the difference between his answer any my original one which syntatically was fine, but Trailhead wouldnt approve it:
Maybe i'm misunderstanding but NOT(ISBLANK(Account.Name)), when I translate this, ISBLANK(Account.Name) will be TRUE to fire, then the the NOT is saying its not true, meaning its not blank? So if that's truly the case, this is only going to fire when something is filled in, which wasn't the challenge? I would think ISBlank(Account.Name) would cause it to fire. Maybe i'm understanding it incorrectly.
I got it right now, so thats good, but looking to improve my knowledge a bit. Thanks!
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Contact must be in Account ZIP Code: []
I created a new dev org and passed the challenge the first time with this rule:
AND(
NOT(ISBLANK(Account.Id)),
MailingPostalCode != Account.ShippingPostalCode
)
So, if you have a proper validation rule that works when you create a new contact but gives an error in Trailhead, I would suggest creating a fresh dev org.
AND(
NOT( ISBLANK( Account.Id ) ),
ShippingPostalCode__c <> MailingPostalCode__c
)
he check syntax is passing with no errors but challenge is not getting completed. Can anyone suggest what should be done? Just to mention Im going to Setup->Opportunities and creating a new Validation Rule.
1. The fields are system fields, not custom fields so they shouldn't have the "__c" on the end.
2. The rule should be on the Contact object.
This rule works:
AND(
NOT(ISBLANK(Account.Id)),
MailingPostalCode != Account.ShippingPostalCode
)
If you use this rule and still get error, create a new dev org.
AND(
ISNEW(),
NOT(ISBLANK ( AccountId )),
MailingPostalCode <> Account.ShippingPostalCode
)
1) The formula works perfectly fine when I try to validate it by myself(not by trail challenge), trying creating or editing contact records. And I have __c at the end of the fields MailingPostalCode__c and ShippingPostalCode__c, but it fails trailhead challenge validation.
2) If I remove __c from the formula(no syntax error occur when you do this) the formula doesn't work when try to edit/create contact records. But the treailhead challange goes fine, why? because the business condition was to provide API name as MailingPostalCode and ShippingPostalCode i.e. without underscores.
The question remains , is it possible to create your own API name(without __c) to get the balance on both the sides, i.e. a working validation rule and a successful challenge completion. All the best everyone.
Thanks,
Kaps
Go To Setup-
Customize-
Contact-
Validation Rules-
Rule name- Contact must be in Account ZIP Code-
Formula-
AND(NOT(ISBLANK(AccountId)) ,MailingPostalCode <> Account.ShippingpostalCode)
Error Message- Zip Codes do not match-
Save
Its done check your Result in your trailhead page...
Please do like if you found this helpful......
You can try the below validation rule, it will help you to complete your challenge.
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode <> Account.ShippingPostalCode
)
If you find your Solution then mark this as the best answer.
Thank you!
Regards
Suraj Tripathi