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
mfcainmfcain 

Phone number restriction

We want to restrict certain phone numbers from being entered in Salesforce.  For example, 999-999-9999, to get around validity checking on format, etc.  What is recommended for doing this?

arizonaarizona

You could use a phone verification service like Towerdata or Strikeiron.  They verify that the phone number has a valid area code and exchange.  I have set that up in our salesforce instance.

mfcainmfcain

So if I wanted to prohibit someone putting in a certain phone number (for example the 999-999-9999), then I'd have to get an application that verifies (or in this case, prevents) the entry of a certain list of numbers...?  The Salesforce validation rules wouldn't address this...?

paul.magpaul.mag

All depends on how many numbers you want to disallow. The way that most people do this is to use a REGEX formula in the validation rule. Something like

NOT( OR(
OR( LEN(  Phone  ) = 0,
REGEX(Phone, "[+49]{3}-[1-9]{1}[0-9]{2,3}-[0-9]{3,9}") ,
REGEX(Phone, "[+49]{3}-[1-9]{1}[0-9]{2,3}-[0-9]{3,9}-[0-9]{1,9}"))))

 

will do it but it all depends on what part of the world you are in and the outputs you want. I got the above by googling "salesforce regex phone"