Accurate information and reports are vital in an effective Salesforce CRM system and without it, users and sales management cannot make informed decisions. One way to achieve accurate information for reporting is by ensuring that data is stored in a consistent manner.
In this recipe, we will create a validation rule to ensure that US zip codes conform to the correct format.
Carry out the following step to create a validation rule:
Valid US Zip Code
in the Field Label textbox (upon clicking out of the textbox, the name changes to Valid_US_Zip_Code).This validation rule is for ensuring the entry of valid US Zip codes
.AND( NOT( REGEX( BillingPostalCode, "\d{5}(-\d{4})?" ) ), OR( UPPER( BillingCountry ) = "US", UPPER( BillingCountry ) = "USA", UPPER( BillingCountry ) = "U.S.A.", UPPER( BillingCountry ) = "U.S.", UPPER( BillingCountry ) = "UNITED STATES" ) )
Please enter a valid US Zip code of the format: five digits as NNNNN or Zip + 4 as in NNNNN-NNNN
.18.118.20.68