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
V DidV Did 

Phone field validation rule

I need to prevent my users from putting in (888)888-8888 into the phone field. Any help or direction would be appreciated.

SporterSporter

You'll need to be more specific on what you want to prevent, just that number (888)888-8888 or that format or what?

V DidV Did

Hi Sporter,

 

Basically we are trying to prevent our users from putting in dummy phone numbers. We already have validations to prevent them from putting in more than 10 digits.

 

 

The following are what we are trying to prevent from being entered into SF

 

e.g. 1111111111 , 2222222222, 3333333333 etc upto 9999999999 and also 1234567890

 

Thank you for your help.

SporterSporter

I need a little more context on top of this also, are you just accepting numbers from the AMER region also (hence 8888888888) always 10 long as you said your other validation rule is. if so you can immeadiately shorten the validtion rule down a little to only the starting area code number.

 

I still think this is possible but if its just a case of all the iterations that might be either the same number i.e. 7777777777 or acension based, 0123456789 then that is easily done but isn't 555 555 5555 a valid number in the states?

 

Anyway here is an example of what you can do with all the numbers but as I said given the right listings of say all area codes possible in the states you could quickly refine this to be more accurate.

 

 

IF(Phone = "1111111111", true, 
IF(Phone = "2222222222", true, 
IF(Phone = "3333333333", true, 
IF(Phone = "4444444444", true, 
IF(Phone = "5555555555", true, 
IF(Phone = "6666666666", true, 
IF(Phone = "7777777777", true, 
IF(Phone = "8888888888", true, 
IF(Phone = "9999999999", true, 
IF(Phone = "0000000000", true, 
IF(Phone = "1234567890", true, 
IF(Phone = "0123456789", true, false))))))))))))

 

 

V DidV Did

We are in the US and all of our numbers in SF are US based. 555 555 5555 is not a real number in the united states but is often used in movies to portray a number on a cell phone.  555 1212 I believe is a real number and is directory assistance.

 

I tried your code and it does not work. The VR will not fire, it is exactly like my original code that I came up with before I turned to this board for ideas. I am starting to believe that I may need to contact SF support with this issue. It seems like it would require a  simple enough validation rule but there may be some other underlying issues here e.g. SF limitations on what you can validate on the phone field.

 

Thank you for all your help Sporter, I truly appreciate it.

SporterSporter

Can you tell me what you entered that didn't cause the validation rule to fire as I tested it a few times without fault.

naveen4unaveen4u

Hi,

 

use Reguler expression(REGEX) in validation rules..