+ Start a Discussion
Nithin Kumar 36Nithin Kumar 36 

Phone number format

I want to format the standard phone number field values. Example value should be 123-456-9876 when we enter as 1234569876 in the phone field? Is it possible?
Hi Nithin,

You can update the phone number field with using str replace functions in workflow field update. Or use a formula field to represent the number in this format. 

Depending on your requirement.

Hope it helps
Nilotpal RoyNilotpal Roy
Yes, It's possible using the below formula in Validation Rule

NOT(REGEX(Phone, "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}"))

Thanks & Regards,
Nilotpal Roy

Hi Nithin,

PFB the resolution mentioned in the standard Salesforce documentation (https://help.salesforce.com/articleView?id=000181563&type=1) below

Phone numbers containing 11 digits
Phone numbers beginning with 1: Data will be saved as a 10 digit number using parenthesis, removing the first digit (1).
Ex: A phone number entered as 12345678901 will be saved as (234) 567-8901
Phone numbers beginning with any other digit: Data will be stored as is without any formatting:
Ex: A phone number entered as 23456789012 will be saved as 23456789012.
Note: To use a custom formatted phone number, enter a “+” before the digits in the number (Ex: +49 1234 56 78-0)
Ajay K DubediAjay K Dubedi
Hi Nithin,

I would like to make sure all phone numbers are updated to conform to this format:
I tried to write a workflow rule to address this as follows:
len(HomePhone) == 12,
left(right(HomePhone,9),1) == '-',
left(right(HomePhone,5),1) == '-',

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Ajay Dubedi