You need to sign in to do that
Don't have an account?
scottskiblack
zip code validations from Winter 07 Release notes no longer work?
I got the zip code validations from the Salesforce Winter 07 Release notes, that have many USA zip code validations but they do not work anymore.
For instance the below validation on the Lead object does validate for the USA but also tries to validate when other countries are entered as well, like Canada in the Country field.
OR(
AND(
OR(Country = "United States", LEN(Country) = 0),
LEN(PostalCode) <>5, LEN(PostalCode) <>
10),
NOT(CONTAINS("0123456789", LEFT( PostalCode, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 2, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 3, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 4, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 5, 1))),
AND(
LEN(PostalCode) = 10,
OR(
MID( PostalCode , 6, 1) <> "-",
NOT(CONTAINS("0123456789", MID( PostalCode , 7,
1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 8,
1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 9,
1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 10,
1))))
)
)
Why do these validations not work anymore?
For instance the below validation on the Lead object does validate for the USA but also tries to validate when other countries are entered as well, like Canada in the Country field.
OR(
AND(
OR(Country = "United States", LEN(Country) = 0),
LEN(PostalCode) <>5, LEN(PostalCode) <>
10),
NOT(CONTAINS("0123456789", LEFT( PostalCode, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 2, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 3, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 4, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 5, 1))),
AND(
LEN(PostalCode) = 10,
OR(
MID( PostalCode , 6, 1) <> "-",
NOT(CONTAINS("0123456789", MID( PostalCode , 7,
1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 8,
1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 9,
1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 10,
1))))
)
)
Why do these validations not work anymore?
AND(
OR(Country = "USA", LEN(Country) = 0),
OR(
AND(LEN(PostalCode) <>5, LEN(PostalCode) <> 10),
NOT(CONTAINS("0123456789", LEFT( PostalCode, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 2, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 3, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 4, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 5, 1))),
AND(
LEN(PostalCode) = 10,
OR(
MID( PostalCode , 6, 1) <> "-",
NOT(CONTAINS("0123456789", MID( PostalCode , 7, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 8, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 9, 1))),
NOT(CONTAINS("0123456789", MID( PostalCode , 10, 1)))
)
)
)
)
Validates that the contact Mailing Zip/Postal Code is in 99999 or 99999-9999 format if Mailing Country is USA or blank.
Description:
OR( AND( OR(MailingCountry = "USA", LEN(MailingCountry) = 0), LEN(MailingPostalCode) 10), NOT(CONTAINS("0123456789", LEFT( MailingPostalCode, 1))), NOT(CONTAINS("0123456789", MID( MailingPostalCode , 2, 1))), NOT(CONTAINS("0123456789", MID( MailingPostalCode , 3, 1))), NOT(CONTAINS("0123456789", MID( MailingPostalCode , 4, 1))), NOT(CONTAINS("0123456789", MID( MailingPostalCode , 5, 1))), AND( LEN(MailingPostalCode) = 10, OR( MID( MailingPostalCode , 6, 1)
Formula:
Error Message: Zip code must be in 99999 or 99999-9999 format. Error Location: Mailing Zip/Postal Code
Scott, if your rule has been working all year and then suddenly stopped working recently, please call support to have them log that as case for us to investigate.
Message Edited by mscotton on 11-07-2007 11:16 AM