Some real-life examples
To complete the chapter, let's see some real-life examples of validation rules you may need in your implementations:
Validate that an address postal code (that is, on Account) must be numeric, five characters long, and start with a zero:
:AND( Â Â LEN( ShippingPostalCode ) == 5, Â Â ISNUMERIC( ShippingPostalCode ), Â Â LEFT( ShippingPostalCode, 1) == "0" )
Validate the billing state for Italian addresses (aka provinces):
:AND ( Â Â BillingCountry = "ITALY", Â Â LEN(BillingState) == 2, Â Â NOT( Â Â Â Â CONTAINS("AG:AL:AN:AO:AR:AP:AT:AV:...", BillingState) Â Â ) )
A complete list of Italian provinces is available on Wikipedia at https://en.wikipedia.org/wiki/Provinces_of_Italy.
Validate the mailing country values on contact against ISO 3166 code (Wikipedia at https://en.wikipedia.org/wiki/ISO_3166-1):
:AND( Â Â LEN(BillingCountry) == 2...