You need to sign in to do that
Don't have an account?
MRivas
Hi all, I would like to know if there is validation rule that will allow the user to entre a phone number in many formats?
I currently have this formula (below) but it does not allows me to save a phone number with the parenthesis. I want to be able to save the phone with or without the parenthesis. I want the user to be able to save the number in any of these formats: XXXXXXXXXX or XXX-XXX-XXXX or (XXX) XXX-XXXX or (XXX)XXX-XXXX. All four ways. Is this possible? Witht the formula below I can save the first 2 formats but not the last 2. Thanks
AND(
OR(
ISNEW(),
ISCHANGED(Phone)
),
NOT(ISBLANK(Phone)),
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))
)
Expression: ^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$
This RegEx requires a US phone number WITH area code. It is written to all users to enter whatever delimiters they want or no delimiters at all (i.e. 111-222-3333, or 111.222.3333, or (111) 222-3333, or 1112223333, etc...).
https://regexlib.com/REDetails.aspx?regexp_id=45
All Answers
Expression: ^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$
This RegEx requires a US phone number WITH area code. It is written to all users to enter whatever delimiters they want or no delimiters at all (i.e. 111-222-3333, or 111.222.3333, or (111) 222-3333, or 1112223333, etc...).
https://regexlib.com/REDetails.aspx?regexp_id=45
https://regexlib.com/Search.aspx?k=us+phone&c=-1&m=-1&ps=20 (https://regexlib.com/Search.aspx?k=us+phone&c=-1&m=-1&ps=20)
Phone field automatic formatting based on User Locale.
Refer the below help article.
https://help.salesforce.com/s/articleView?id=000330422&type=1
If this information helps, Please mark it as best answer.
Thanks!!
Is there a way to have many phone fields into one validation rule?? Or salesforce just allows one phone per rule?