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
Rohit TripathiRohit Tripathi 

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.
Best Answer chosen by Rohit Tripathi
Amit Chaudhary 8Amit Chaudhary 8
Please try below valudation rule
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
)
i Used same and got all points in Trailhead challenge


 

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try below valudation rule
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
)
i Used same and got all points in Trailhead challenge


 
This was selected as the best answer
Rohit TripathiRohit Tripathi
Hi Amit,

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 ?
 
Amit Chaudhary 8Amit Chaudhary 8
Hi Rohit,

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
 
Rohit TripathiRohit Tripathi
Thanks Amit.

API link is not working. Do you have Navigation path ?
Sakthivel ThandavarayanSakthivel Thandavarayan
That's the correct link... you can refer the field names here,

https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_contact.htm

 
Shane MphaheleShane Mphahele
@Amit Chaudhary 8.. I used the same Formula but got an error, 

Challenge not yet complete... here's what's wrong: 
The validation rule failed to enforce the business logic.
User-added image
Amit Chaudhary 8Amit Chaudhary 8
Please try to use below code
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
)

 
Shane MphaheleShane Mphahele
I just changed the operator to != , still got the same error
Shane MphaheleShane Mphahele
Not sure if trailhead is the problem or my DE org.  
:'(
Amit Chaudhary 8Amit Chaudhary 8
You can do one thing .
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
Shane MphaheleShane Mphahele
I did do as you said, unfortunately I am still not winning.
same error.
"Challenge not yet complete... here's what's wrong: 
The validation rule failed to enforce the business logic"
Shane MphaheleShane Mphahele
Finally it worked, but I had to close spaces!!! Thanks @Amit Chaudhary 8
User-added image
Crystal ZhuCrystal Zhu
I just finished the challenge.  Here is the Error Condition Formula:  ( Account.ShippingPostalCode <> MailingPostalCode) && NOT(ISBLANK (Account.Name)). If  "insert operator" was used, it was quite simple. Cheers,
Levi BohonLevi Bohon
AND( 
NOT(ISBLANK(Account.ShippingPostalCode)), 
MailingPostalCode <> Account.ShippingPostalCode)
Anil ShekharAnil Shekhar
Here is what worked for me ... 
Error condition formular: ((ShippingPostalCode <> Owner.Contact.MailingPostalCode) && NOT(ISBLANK(Name)))
Adeline MooreAdeline Moore
I am working on this trail as well and am getting the following error Please help me determine where I am going wrong:
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:

User-added image
Brianne Beatty 16Brianne Beatty 16
The problem with this code is that TrailHead accepted it as the correct code but it doesn't allow the contact associated with an Account .. So the TrailHead is flawed.
David OknerDavid Okner
Shouldn't the code be this:

AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode != Account.ShippingPostalCode
 ||  MailingPostalCode !=  Account.BillingPostalCode 
)
To account for both billing and shipping addresses?
Srinivas A 17Srinivas A 17
@Adeline Moore:i too faced this issue but after deleting and re-creating the validation rule it was success.
Used code is :
AND(NOT(ISBLANK(AccountId)),MailingPostalCode != Account.ShippingPostalCode)

Query:
What is the differnce between these two operators <>and !=?
 
ashley brownashley brown
why was != used and not the supplied operator <>
Ishita Jain 7Ishita Jain 7
I am still getting the error as follows:

User-added image 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: Delete failed. First exception on row 0 with id 0033600000jXw2eAAC; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Account id is null. Cannot delete it: []
Amit Chaudhary 8Amit Chaudhary 8
It look like you created any Custom Validation or trigger due to that validation rule is executing. Please deactivate the same and try again
Sravan Varanasi 3Sravan Varanasi 3
When I was trying to solve this challenge, I was getting the following error.

User-added image

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!
Vaishali mehtaVaishali mehta
I am using the solution :

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.
 
Amit Chaudhary 8Amit Chaudhary 8
Please check you have created any validation rule on contact object, If yes then please deactivate the same and try again
vamshidher reddyvamshidher reddy
Actual formula is,
AND( 
NOT(ISBLANK(Account.ShippingPostalCode)), 
MailingPostalCode <> Account.ShippingPostalCode)
Abhishek Puri 7Abhishek Puri 7
ISBLANK( MailingPostalCode ) && Account.ShippingPostalCode <> MailingPostalCode
shivam sharma 44shivam sharma 44
Challenge completed.Try with below
NOT(ISBLANK(AccountId))&& ( Account.ShippingPostalCode != MailingPostalCode )
Riddhesh PatelRiddhesh Patel
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: 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
Amit Chaudhary 8Amit Chaudhary 8
Look like you create a validation rule on Contact_Name__c field or you created Contact_Name__c field as required field.
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
Amit Agrawal 90Amit Agrawal 90
Thanks Amit, this helped ...one more challenge completed 
md saif ansarimd saif ansari
100% Will Work This Code......Try This code you will get all points in trailhead.
AND( 
NOT(ISBLANK(AccountId)), 
MailingPostalCode = Account.ShippingPostalCode)
JRR TWOJRR TWO
Any hints for this error? All my Workflow Rules are deactivated:

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.: []
Josh OverettJosh Overett
I kept getting errors despite using many different code versions copied from previous replies and removing and recreating the rule multiple times as well and also logging out and in to the playground as well. In the end I solved it by using an alternative sandbox/playground I had previously created and creating the same rule in there. Worked first time Challenge solved. I suspect it was a bug/glitch in the Trailhead - Playgournd checking system.
Amber SharmaAmber Sharma
The Below Code Works Well :)
AND( 
          NOT(ISBLANK(Account.Name)),
                OR(
                                ISBLANK(MailingPostalCode),
                                Account.ShippingPostalCode <> MailingPostalCode
                )
)

It is also applied when the MailingPostalCode field of Contact is blank.
Merlyn Manuel (Gomez)Merlyn Manuel (Gomez)
ISBLANK(  Owner.Address )  = ISBLANK(Account.ShippingPostalCode)

This worked for me.
Andrea DalsenoAndrea Dalseno

Also

NOT OR(
ISBLANK(  AccountId  ),  
MailingPostalCode = Account.ShippingPostalCode )
kora bornkora born
Of all the comments here, only ansari's worked - which doesn't make any sense, as he used an = instead of <>
(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 ??

 
Bernard Philipsen 6Bernard Philipsen 6
Hi all,

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?
kora bornkora born
Since it is a different error you should have opened another thread instead of posting here ?
Ilya IvanovskiyIlya Ivanovskiy
Create a validation rule to check that a contact is in the zip code of its account.
 
AND(
  NOT( ISBLANK( AccountId ) ),
  MailingPostalCode <> Account.ShippingPostalCode
)

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.
Marileus BernardezMarileus Bernardez

11-18-18 updated formula

AND( 
NOT(ISBLANK(ShippingPostalCode)), 
BillingPostalCode <> ShippingPostalCode)

Ranajit DondRanajit Dond
User-added image
Ranajit DondRanajit Dond
tell me the formula
 
UDAYA TEJA PASUPULETIUDAYA TEJA PASUPULETI
first creater this 2 custom fields in Contact object

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!
Deede Heard 7Deede Heard 7
I was also receiving an error when Trailhead was attempting to validate my work on this trail in my developer org.  I ended up figuring out that the issue had to do with the EDA Managed Package that I had previously installed.  I ended up inactivating the Trigger Handlers for Addresses and Accounts and the validation was successful.
Deepti Gupta 12Deepti Gupta 12
Hi Amit,

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.
Vipal PatelVipal Patel
Thanks Amit Chaudhary,

This code helped me out :)

AND(
2NOT(ISBLANK(AccountId)),
3MailingPostalCode != Account.ShippingPostalCode
4)
Mohamadou DOUCOUREMohamadou DOUCOURE
AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode <> Account.ShippingPostalCode
)
Yousuf ZamanYousuf Zaman
This worked for me.
AND( 
          NOT(ISBLANK(Account.Name)),
                OR(
                                ISBLANK(MailingPostalCode),
                                Account.ShippingPostalCode <> MailingPostalCode
                )
)

 
ankur jain 94ankur jain 94
Below code worked for me
AND(
NOT(ISBLANK(Account.Name)),
OR(
ISBLANK(MailingPostalCode),
Account.ShippingPostalCode <> MailingPostalCode
)
)
somebody above shared this code. Thanks!
Amarnath Reddy 46Amarnath Reddy 46
I was getting error like : ShippingPostalCode is not mapped to Account (something of that sought). i came here to check if the validation rule i implemented is correct (that's was ok). Then, i accidently happened to delete one of the Contact Objects..
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. 
User-added image
Ulrich TIEFENGUlrich TIEFENG
User-added image
AND(
NOT(ISBLANK(Account.Name)),
OR(
ISBLANK(MailingPostalCode),
Account.ShippingPostalCode <> MailingPostalCode))
Chandrakant Shinde 10Chandrakant Shinde 10
This worked fine for me

AND(
NOT(ISBLANK(AccountId)),
MailingPostalCode <> Account.ShippingPostalCode
)
Pruthviraj PatilPruthviraj Patil
Thank You, Team,
I use the following formula and it works.
AND( 
NOT(ISBLANK( ShippingPostalCode )), 
 BillingPostalCode  <>  ShippingPostalCode )
Olga DemailOlga Demail

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 )

Angel Ramirez 11Angel Ramirez 11
create the validation rule on the contact object.
AND(
NOT(ISBLANK( AccountId )),
Account.BillingPostalCode <> Account.ShippingPostalCode
)


 
Sakshi Pandey 32Sakshi Pandey 32
AND(
NOT(ISBLANK(  Id  )),
  BillingPostalCode  <>  ShippingPostalCode
)
This works
 
Mahesh Yallur 7Mahesh Yallur 7
 This is what Trail head expecting you to complete the task.

AND((ISBLANK( AccountId )),NOT((MailingPostalCode <> Account.ShippingPostalCode)))
Marileus Bernardez 5Marileus Bernardez 5
Thank me later.

AND(
NOT(ISBLANK( Name )),
BillingPostalCode <> ShippingPostalCode
)
Samantha EgleSamantha Egle

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. 

Sparsh SharmaSparsh Sharma
I am getting this error and i have done every thing correctly still I don't understand whats the problem here
I am getting this error and i have done every thing correctly still I don't understand whats the problem here
Daniella FlayDaniella Flay
I am getting the same error as Samantha and Sparsh. Any idea on what the solution is? Have also tried every variation in this thread.
Fabiana MoreiraFabiana Moreira
Hi Amit Chaudhary 8

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?







 
Amit Patil 85Amit Patil 85
Sparsh Sharma, Fabiana Moreira,Daniella Flay

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.
Anish Siva 6Anish Siva 6
the solution to the problem 
"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 )
olansi chinaolansi china
It's amazing stuff, Thanks for sharing your valuable information. Could you please let me know the solution to a problem that is related to luftreiniger (https://www.olanside.com) and I am getting the same error of as Samantha and Sparsh Any idea on what the solution is? 
covore7855 covore7855covore7855 covore7855
Indian Escorts in Dubai (http://www.modelofdubai.com) is pretty famous for providing various kinds of escort services. +971-563680438
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.
 
Vikram Kumar 55Vikram Kumar 55
Amit you are Great!
After Complete this module Trailhead give a Trailblazer Hoodie
Fahim Khan 13Fahim Khan 13

So this formula works for me :

 

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

Venkat ChidipudiVenkat Chidipudi
Hey, please try this formula, its perfectly worked for me.

AND(
NOT(ISBLANK(Id)),
 BillingPostalCode <> ShippingPostalCode
)
Jeff Wang 28Jeff Wang 28
Today is 2022/06/17, below formula works for me:

 ((ShippingPostalCode <> Owner.Contact.MailingPostalCode) && NOT(ISBLANK(Name)))
intergation orgintergation org
The challenge is completed!

AND(
(NOT(ISBLANK( AccountId ))) ||

(NOT(MailingPostalCode <> Account.ShippingPostalCode)))
Kishor Chandra SoramKishor Chandra Soram
For those of you who are still struggling make sure the Validation rule is created on CONTACT object not in Account.
Carlos Mesa 1Carlos Mesa 1
Correct make sure to build the rule in the Contact obj (setup > obj manager > contact > validation rules).
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
)
Abhinaya TalasilaAbhinaya Talasila
Hi , 

I still get error using the same rule, 

User-added image

User-added image
Pranshu AroraPranshu Arora
Hi Guys,

Try below syntax worked for me.

AND( NOT(ISBLANK( Id )),  Owner.Contact.MailingPostalCode  <>   Owner.Contact.Account.ShippingPostalCode )
Arturo Briones OrtegaArturo Briones Ortega
Hi, I have problems beacuse I created the validation rule in the Account. That is wrong, it must be create on the CONTACT. 
Tal VirdeeTal Virdee
I have had this same issue for days too: "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.'"
So I created a brand new playground, used the same syntex:User-added image

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

and it finally worked! 

 

 
Jamile Frias-GilJamile Frias-Gil
This is what worked for me.

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

Just make sure that you are not using EDA org.
divine handdivine hand
i tried every   formula here  still can not  complete  trailhead.  İt says 
" 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
Carlos RamírezCarlos Ramírez
I have checked the Contact object and i found out that Loan Amount field was obligatory, so that was giving problem when creating the contact. I have unchecked that field as obligatory and I could achive the challenge.
chinmaya sahoochinmaya sahoo
Hi I am unable to clear this task in trailhead. but getting the error as below for the Create Validation Rule in Contact. 

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
Lovelyn ODEHLovelyn ODEH
This is what worked for me:
AND(
NOT(ISBLANK(Id)),
Owner.Contact.MailingPostalCode !=  Owner.Contact.Account.ShippingPostalCode 
)
Keny PatidarKeny Patidar
Hi,
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
APOORVA PRATAP SINGHAPOORVA PRATAP SINGH
Hi Guys,

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.
Abas Sunday 1Abas Sunday 1
Formula that works form me
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