+ Start a Discussion

Phone Number Validations

How do I create a validation for phone numbering formatting?  Currently users can enter a US phone number or international number, how can I create a validation rule to format the US phone # and international phone # accordingly?
Steve :-/Steve :-/

You probably have to combine these 2 formulas with another formula that evaulates the Country field



US Phone



US Phone Number Has Ten Digits Field Value Description: Validates that the Phone number is in (999) 999-9999 format. This works by using the REGEX function to check that the number has ten digits in the (999) 999-9999 format.

Formula: NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))


Error Message: US phone numbers should be in this format: (999) 999-9999. Error Location: Phone

 Int'l Phone


Phone Number Has International Format Field Value Description: Validates that the Phone number begins with a plus sign (+) for country code. Note that this validation rule conflicts with the ten-digit rule. Formula: LEFT(Phone, 1) <> "+" Error Message: Phone number must begin with + (country code). Error Location: Phone






Igor PetrovychIgor Petrovych
If you need a more advanced validation of a number, to make sure you really have a valid number - you can do that in the trigger handler, and use a ported libphonenumber (http://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000G12oJUAR) library.