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
csombcsomb 

Format the incoming phone from input screen of Flows ( 10 digits) as (999) 999-9999.

RajaramRajaram
Use the regular expression for validation.
Sonam_SFDCSonam_SFDC

Hi,

Try usign the folowing validation formula to get the desired Phone number format:

NOT(REGEX( PHONE FIELD NAME, ""[(][0-9]{3}[)] [0-9]{3}-[0-9]{4}""))

e.g.:
NOT(REGEX( phone_testing__c, ""[(][0-9]{3}[)] [0-9]{3}-[0-9]{4}""))

To read about REGEX, go to - http://ap1.salesforce.com/help/doc/en/customize_functions_i_z.htm#REGEX

Hope this helps!

csombcsomb
Entered your REGEX as provided and received syntax error. Missing ')'.


Try usign the folowing validation formula to get the desired Phone number format:

NOT(REGEX( PHONE FIELD NAME, ""[(][0-9]{3}[)] [0-9]{3}-[0-9]{4}""))

e.g.:
NOT(REGEX( phone_testing__c, ""[(][0-9]{3}[)] [0-9]{3}-[0-9]{4}""))

To read about REGEX, go to - http://ap1.salesforce.com/help/doc/en/customize_functions_i_z.htm#REGEX

Hope this helps!



[cid:image001.png@01CE6CC8.4C6BDF40]

Charn Somboonsiri

eCommerce Sales/Marketing Systems
Coventry Health Care, Inc.
Phone: 480 445-2751

Data Classification: Internal Use Only
Policy Reference:
InfoSecPolicy 06.01.01- Data Classification



Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA).

The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer.
C@CvtyC@Cvty

Used the REGEX provided but received syntax error. Missing ')', I removed the " on both end and VR has no error. But the VR didn't format the phone from 2223334444 to (222) 333-4444.

 

NOT(REGEX( Entered_Phone, "[(][0-9]{3}[)] [0-9]{3}-[0-9]{4}"))

 

 Don't know how to paste a screen snapshot in here.

 

 

 

 

RajaramRajaram
Sorry.. did you want to format the phone or validate the format?
The Validation rule is to validate the phone and not necessarily to format the value.
In other words, 2025551212 is a valid phone and if you want to store this as (202)-555-1212 then that is a different format.

Regular expressions are typically used to validate the phone number.

You can have a regular expression which requires the user to enter it in the format you want though in which case you are not "converting" a valid phone number into a particular format you want.

makes sense?
C@CvtyC@Cvty
 
I'd like someone to show me how to format the normal user enty (10 digits text field) of 2025551212 in screen capture in Flows (so user don't have to enter it with the () and - just plain 10 digits number) and have the flow format it into (202) 555-1212. So all my Flows input Lead are captured with the uniform phone number as it does in all other SFDC Phone field.  I don't want to keep the user entered 10 digits phone number, rather keep it in SFDC as (202) 555-1212 format but just don't know how to do it in the Flows - thought the Validation would format the incoming input for me but it doesn't.
 
 
RajaramRajaram
If you enter 2015551212 in a flow, then the data will be stored as-is. The formatting is done on the client side. If you did this in Apex, it would be the same behavior as Apex.
Interestingly, if you edit the field but tab out, it will get re-formatted automatically.
If you really want to format it and store it, you need to create an Apex Plug-in to do that.
csombcsomb
Hi Rajaram,


If you enter 2015551212 in a flow, then the data will be stored as-is. The formatting is done on the client side. If you did this in Apex, it would be the same behavior as Apex.
Interestingly, if you edit the field but tab out, it will get re-formatted automatically.
If you really want to format it and store it, you need to create an Apex Plug-in to do that.
How do I go about formatting (The formatting is done on the client side) I don't see anywhere in the Flows to edit the input field entered on the Screen Input page except the Input Validation which is not for the formatting the input but to validate that the input is in certain format.

Can you provide me with some samples of the Apex Plug-in that I can use?

Thanks.


Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA).

The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer.
RajaramRajaram
Here you go...
https://github.com/raja-sfdc/FlowFormatPhonetoUS

There are 2 classes there.. you can just copy and paste into your org or you can use the ant tool to get the repository from git and upload both the flow and the plugin.

Hope this helps..
Mitch_AMSMitch_AMS

I'm new to flow designer. I'm very excited about the potential it offers. But correct me if I'm wrong here. Is SF actually asking everyone else to build what should already be native? instead of taking resposibility for this obvious oversite.

 

Would you buy a new car if you had to manufacture your own steering wheel?

 

Sorry, but phone number formatting should not be classified as a "Customization"

 

In any event, the class and test class do work though. Thanks Rajaram for your suggestion, and thanks to whom ever publised this FIX.

sales.forcesales.force
Please vote for this idea: https://success.salesforce.com/ideaView?id=08730000000kxrmAAA&sort=2
Gerri WheelerGerri Wheeler
For people in the declarative world;  here's a possible solution:

Caveat - It's not sophisticated and you will need to do this for each phone entry contained in your flow:

On the screen where a phone number field is offered, the user enters 9991114444.  What they enter is a screen entry which has been stored in the Screen Input Field.  

Create a formula:  From resources create a new formula; give it a unique name and paste the sample formula below in the lower box.  You will need to change out the references to "screeninputPhoneNumber" using the select resource and locating the actual Screen Input names you are using in the flow.
 
"("&Left({!screeninputPhoneNumber},3)&") "&mid({!screeninputPhoneNumber},4,3)&"-"&right({!screeninputPhoneNumber},4)
 
Creat a Variable:  From Resources create a new variable, give it a unique name and select your new formula in the Default Value area.

When updating or creating a new record instead of passing the Screen Input field to the new record; pass the new variable containing the formula into the phone field in Salesforce.
Lesa HarveyLesa Harvey
Thanks Gerri. I used the formula, but had to make sure the formula format was text to get it to work.
SV MSV M
Hey @Gerri Wheeler can you tell me how to validate text filed to display the entered the phone number in US format which is (999) 999-9999.