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
khushbu dubeykhushbu dubey 

WHAT IS VALIDATION RULE FOR POSTAL CODE??

DebasisDebasis
Hi Dubey,

You can use below formula to validate postal code. This formula is using regex for validating the input to the postal code

  NOT(
       REGEX(
Your postal code field api name, "((?i)[ABCEGHJKLMNPRSTVXY]\\d[A-Z]?\\s?\\d[A-Z]\\d)?")
       )


Hope this will help you. :)
JyothsnaJyothsna (Salesforce Developers) 
Hi,

By using REGEX function we can build validation rule to enforces proper data format.

Example: Validates Account Billing Zip/Postal Code is in 5 digit format or 9 digit format if billing country is the USA.

Error condition formula for this example:
 
(BillingCountry=="USA")&&NOT(REGEX(BillingPostalCode,"\\d{5}(-\\d{4})?"))

​Please check the below link for more details

https://developer.salesforce.com/docs/atlas.en-us.usefulValidationRules.meta/usefulValidationRules/fields_useful_validation_formulas_contact.htm

Hope this helps you!
Best Regards,
​Jyothsna​
Head In CloudHead In Cloud
Hi ,
Validates that the account Billing Zip/Postal Code is in the correct format ifBilling Country is Canada.

AND(
OR(BillingCountry = "CAN", BillingCountry = "CA", BillingCountry = "Canada"),
NOT(REGEX(BillingPostalCode,
"((?i)[ABCEGHJKLMNPRSTVXY]\\d[A-Z]?\\s?\\d[A-Z]\\d)?"))
)

For more detail please review the following link
https://help.salesforce.com/HTViewHelpDoc?id=fields_useful_validation_formulas_account_address.htm&language=en_US

Hope this helps you!
Thanks
Vijay NagarathinamVijay Nagarathinam
use the below validation rule.
 
(BillingCountry=="USA")&&NOT(REGEX(BillingPostalCode,"\\d{5}(-\\d{4})?"))

 
Malika Pathak 9Malika Pathak 9

Hi khushbu,

find the below solution

NOT(ISNUMBER(BillingPostalCode))

if you find this helpful mark it as the best answer.