You need to sign in to do that
Don't have an account?
Create a validation rule to check that a contact is in the zip code of its account.
I am getting error message while solving this challenge in 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)
Error Message is : There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.
I am not sure what went wrong here.
My Validation Rule is on Contact Object :
AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))
Can anyone please help with this.
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)
Error Message is : There was an unhandled exception. Please reference ID: HKIZNLVZ. Error: Trailhead::TrailheadTimeOut. Message: Trailhead.view: failed to get a 200 response. Made 3 attempts each resulting in a 403 or 500 failure for url challenges?key=%5B%22trailhead.challenge.validation_rules.en.us.192%22%5D.
I am not sure what went wrong here.
My Validation Rule is on Contact Object :
AND ( NOT(ISBLANK( Account.Name)),
( MailingPostalCode <> Account.ShippingPostalCode))
Can anyone please help with this.
All Answers
It worked. I have few questions :
1) How did you come up with != operator
2) If you look Field dettails for Contact Object, Account field is of data type Lookup(Account). How did you come up with AccountID ?
1) According to validation rule we need to check if both are not equals same means !=.
2) On Contact we have account Lookup(Account) which API name is AccountId.
you Can check API name from below link:-
Account:-
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_account.htm
Contact:-
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_contact.htm
API link is not working. Do you have Navigation path ?
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_contact.htm
Challenge not yet complete... here's what's wrong:
The validation rule failed to enforce the business logic.
:'(
Step 1) Delete above validation rule and try again
Step 2) Try to login with some other DE org and try.
I hope this will help u
same error.
"Challenge not yet complete... here's what's wrong:
The validation rule failed to enforce the business logic"
NOT(ISBLANK(Account.ShippingPostalCode)),
MailingPostalCode <> Account.ShippingPostalCode)
Error condition formular: ((ShippingPostalCode <> Owner.Contact.MailingPostalCode) && NOT(ISBLANK(Name)))
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, A contact with a MailingPostalCode that has an account and does not match: []
Create a validation rule to check that a contact is in the zip code of its account.
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)
Here is a screen shot of my rule:
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
|| MailingPostalCode != Account.BillingPostalCode
)
To account for both billing and shipping addresses?
Used code is :
AND(NOT(ISBLANK(AccountId)),MailingPostalCode != Account.ShippingPostalCode)
Query:
What is the differnce between these two operators <>and !=?
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Delete failed. First exception on row 0 with id 0033600000jXw2eAAC; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Account id is null. Cannot delete it: []
The rule I have written:
AND(NOT(ISBLANK(AccountId)), Mailing_Postal_Code__c != Account.Account_Shipping_Postal_Code__c)
However, when I changed the API name in the formula from "Shipping_Postal_Code__c" to "ShippingPostalCode" manually, I was able to pass the challenge.
I was hoping to understand the difference between both the naming conventions, because when I try to insert the field through the "insert field" button, it is inserting the API name with underscore by default.
Any help would be appreciated. Thanks!
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode)
But still getting this error :
Challenge Not yet complete... here's what's wrong:
A contact with no parent account could not be inserted. The validation rule should only apply to contact records with an associated account.
Please help me out.
AND(
NOT(ISBLANK(Account.ShippingPostalCode)),
MailingPostalCode <> Account.ShippingPostalCode)
NOT(ISBLANK(AccountId))&& ( Account.ShippingPostalCode != MailingPostalCode )
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: REQUIRED_FIELD_MISSING, Required fields are missing: [Contact_Name__c]: [Contact_Name__c]
This is the error I am getting. I used
NOT(ISBLANK(AccountId))&& ( Account.ShippingPostalCode != MailingPostalCode )
PLease help
If you created the validation rule then please deactivate the same or if field is required at field level then uncheck the required check box and try again
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode = Account.ShippingPostalCode)
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: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30161000000QaNy. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: []
AND(
NOT(ISBLANK(Account.Name)),
OR(
ISBLANK(MailingPostalCode),
Account.ShippingPostalCode <> MailingPostalCode
)
)
It is also applied when the MailingPostalCode field of Contact is blank.
This worked for me.
Also
(And the sad part here is, the motive is not to get all the trail points BUT to understand working with SFSC.)
The edit validation screen clearly says "If this formula expression is TRUE, display the text defined in the Error Message area"
So logically speaking, shouldn't it be: MailingPostalCode <> Account.ShippingPostalCode ??
I've been getting an different kind of error before saving. With my syntax check i get "Field AccountId does not exist". And after trying other solutions ( eg with account name which is a field showing in the picklist) as stated above i get the same in my DE org or my normal trailhead org. So i added a AccountId field, but i still get this syntax error.
Any suggestions?
If you get an error:
Error: Field AccountId does not exist. Check spelling.
This means that you are trying to create a rule in the account object.
The rule must be created in the contacts object.
11-18-18 updated formula
AND(
NOT(ISBLANK(ShippingPostalCode)),
BillingPostalCode <> ShippingPostalCode)
MailingPostalCode
ShippingPostalCode
create validation rule on Custom object with name Contact must be in Account ZIP Code, then use the bleow code.
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode <> Account.ShippingPostalCode
)
So, first, the "And ( )" is telling the system, "Make sure everything within these ( ) is true." For instance, "And (Table is Red; Table has four legs)" This will only find you tables that are red and with four legs; not tables that are red with three legs, or blue tables with four legs. Next is the actual formula within the "And ( )." "Not (ISBLANK(Account))," is telling the system that if "Account" "is blank (ISBLANK)," then don't worry about triggering. So if a contact has something listed under the "Account field," then it's good to go. Or, in English, "only trigger if the account within the contact field is not blank." The next line is the second part of the "And ( )" formula. MailingPostalCode is in reference to the contact's ZIP Code <> means "does not equal" Account.ShippingPostalCode is in reference to the account's shipping ZIP Code. Thus instead of using those words, let's use just what it means, "Contact's zip code" - "does not equal" - "Account zip code." Thus, in the end, this code is saying, "When contact has an account AND the contact's zip code is not equal to the account's zip code, THEN trigger this error." Let me know if you have any questions about any of that!
Can you please help me to understand the formula you have shared. I am still getting an error message and not able to find MailingPostalCode field.
Thanks in advance.
This code helped me out :)
AND(
2NOT(ISBLANK(AccountId)),
3MailingPostalCode != Account.ShippingPostalCode
4)
NOT(ISBLANK(AccountId)),
MailingPostalCode <> Account.ShippingPostalCode
)
AND(
NOT(ISBLANK(Account.Name)),
OR(
ISBLANK(MailingPostalCode),
Account.ShippingPostalCode <> MailingPostalCode
)
)
somebody above shared this code. Thanks!
So you need to you two Contact objects in obj manager...
if you think you messed it then try to complete the challenge into developer edition.
workaround 1 > create in Dev Edition (OR)
workaround 2 > check if you have all data (shipping pos code under account), mailing post code & two contact objects.
AND(
NOT(ISBLANK(Account.Name)),
OR(
ISBLANK(MailingPostalCode),
Account.ShippingPostalCode <> MailingPostalCode))
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode <> Account.ShippingPostalCode
)
I use the following formula and it works.
AND(
NOT(ISBLANK( ShippingPostalCode )),
BillingPostalCode <> ShippingPostalCode )
Thank You all.
The following formula is working. Check that you create it in Contact Object, and not in Account Object ;)
AND(
NOT(ISBLANK( ShippingPostalCode )),
BillingPostalCode <> ShippingPostalCode )
AND(
NOT(ISBLANK( AccountId )),
Account.BillingPostalCode <> Account.ShippingPostalCode
)
NOT(ISBLANK( Id )),
BillingPostalCode <> ShippingPostalCode
)
This works
AND((ISBLANK( AccountId )),NOT((MailingPostalCode <> Account.ShippingPostalCode)))
AND(
NOT(ISBLANK( Name )),
BillingPostalCode <> ShippingPostalCode
)
Help please!
I am banging my head against a wall. I've tried every single code posted in this thread and they either don't work or I get this error message:
We can't create a contact by itself (without an associated account). Make sure the validation rule applies ONLY when the contact has an associated account.
HOW DO I MAKE SURE IT ONLY APPLIES WHEN THE CONTACT HAS AN ASSOCIATED ACCOUNT?
Thanks in advance.
I am getting this error and i have done every thing correctly still I don't understand whats the problem here
I need to complete the module and I came across this error when validating the challenge.
We can't create a contact by itself (without an associated account). Make sure the validation rule applies ONLY when the contact has an associated account.
I verified that I have a contact registered with my name. I checked the AccountId inside the Account and it is within the defaults. This also applies to the Account and Contacts objects.
Could you help me with this error?
i was getting same error, and came across to below solution on one youtube. try below and check...!!!
AND(
NOT(ISBLANK( AccountId )),
MailingPostalCode <> Account.ShippingPostalCode
)
in above solution instead of Accountid i was using anoter parameter like MailingPostalcode. after updating to Accountid the issue resolved and i was able to clear the stage.
"Challenge not yet complete in My Trailhead Playground 1
We can't create a contact by itself (without an associated account). Make sure the validation rule applies ONLY when the contact has an associated account." is to create a new playground and use the code given below
AND( NOT(ISBLANK(AccountId)), MailingPostalCode <> Account.ShippingPostalCode )
Escorts in Abu Dhabi (http://www.uaehotcollection.com) Indian Escorts in Abu Dhabi Call Mannat +971561033256, A well known professional, educated escorts, who offers high class Independent Abu Dhabi Escorts Service.
Indian Call Girls Dubai (https://www.vvipmodel.com) Call/WhatsaPP +971561033256, Indian Escorts in Dubai, Call Girls Dubai. Indian Celebrities Escorts In Dubai Contact Indian Independent Escort in Dubai, Very Cheap Price and safe Independent Escorts Dubai.
Indian Escort in Abu Dhabi (http://www.simmi-patel.com) Indian Escort Girl in Abu Dhabi With. Our Abu Dhabi Escorts and Independent Agency Abu Dhabi Escorts aren't simply standard girls as you will verify.
Dubai independent escort (http://www.tanishaverma.com) If you are searching for the same that is the escort with elegant personality then your search is finish as you have landed in the right site.
After Complete this module Trailhead give a Trailblazer Hoodie
So this formula works for me :
AND( NOT(ISBLANK( Account.Name )),
( MailingPostalCode <> Account.ShippingPostalCode ) )
AND(
NOT(ISBLANK(Id)),
BillingPostalCode <> ShippingPostalCode
)
((ShippingPostalCode <> Owner.Contact.MailingPostalCode) && NOT(ISBLANK(Name)))
AND(
(NOT(ISBLANK( AccountId ))) ||
(NOT(MailingPostalCode <> Account.ShippingPostalCode)))
Then I used the the formula below to validate the contact field Mailing Zip Code/Postal Code (MailingPostalCode) is the same as the Account field Shipping Zip Code/Postal Code (Account.ShippingPostalCode) after confirming the contact field accound id (AccountId) is not blank.
--
AND
(
NOT (ISBLANK(AccountId)),
Account.ShippingPostalCode <> MailingPostalCode
)
I still get error using the same rule,
Try below syntax worked for me.
AND( NOT(ISBLANK( Id )), Owner.Contact.MailingPostalCode <> Owner.Contact.Account.ShippingPostalCode )
So I created a brand new playground, used the same syntex:
AND(
NOT( ISBLANK( AccountId ) ) ,
MailingPostalCode <> Account.ShippingPostalCode )
and it finally worked!
AND(
NOT(ISBLANK(Account.Name)),
OR(
ISBLANK(MailingPostalCode),
Account.ShippingPostalCode <> MailingPostalCode
)
)
Just make sure that you are not using EDA org.
" We can't create a contact by itself (without an associated account). Make sure the validation rule applies ONLY when the contact has an associated account. "
Even i tried to open new contact from the object used MailingPostalCode dissimilar with the account ShippingPostalCode. It gave an error cuz of the dissimilar postalcode account and contact. So Rule worked and still didnt gave me poimts
We can't create a contact by itself (without an associated account). Make sure the validation rule applies ONLY when the contact has an associated account. Can someone help? Thanks in advance
AND(
NOT(ISBLANK(Id)),
Owner.Contact.MailingPostalCode != Owner.Contact.Account.ShippingPostalCode
)
Below code is not working for me :
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode <> Account.ShippingPostalCode
)
Create a validation rule:
Rule Name: Contact_must_be_in_Account_ZIP_Code
Operator: AND (return true if both conditions are true)
Define the two conditions that, combined, will show the error message:
The contact is associated with an account id
The contact mailing zip code is different than the account shipping zip code
Hint: Use the API names (MailingPostalCode and Account.ShippingPostalCode) and the <> (Not Equal) operator.
Enter an error message for the validation rule
This works for me:
AND(
NOT(ISBLANK( Id )),
Owner.Contact.MailingPostalCode <> Owner.Contact.Account.ShippingPostalCode
)
Note : "Owner.Contact.MailingPostalCode" and "Owner.Contact.Account.ShippingPostalCode" write full then only works.
Attached is the formula that has worked for me and if you face any sort error, i would say change the Org and it will work