0

Good day Salesforce Dev's!

I have a question for you, hope you have the solution for this.

Im implementing a Flow that fires when a record (account) is created. When the phone number is created, in the field input you enter a string of numbers, what the flow will receive is for example: 15714788202

The idea of the flow, is instead of generating that number, that the visible phone number in the record has a mask like this: +1 571-478-8202. So the flow should receive the string, add the +1 at the beginning, add a space and then after the 571 add a "-" and so on.

It is possible or should I create an apex class that receives that string and returns that mask? (not recommended)

Trying to brainstorm this, the easiest way would be the apex class but it seems that the client want to use only salesforce features and no external help (like, the apex class). I Think that a formula might help, but dont know how to apply it.

1
  • What if the person enters spaces or parentheses or dashes in the number? Sep 12, 2022 at 13:58

1 Answer 1

1

Assuming the input is always a NANP (North America Numbering Plan) phone number and entered with 10 digits

Let's make the flow field called phoneRaw

  • Create a formula element in the flow called phoneFormattedE164

    '+1 ' &
    MID(phoneRaw,1,3) & '-' & 
    MID(phoneRaw,4,3) & '-' &
    MID(phoneRaw,7,4)
    
  • Then assign this formula element to the Account.Phone field (or whatever custom field you are using) in your Create (or Update) records element

Be sure to add a screen element validation check for testing for 10 characters. You could include checks for alpha as well.

MID formula ref

Not the answer you're looking for? Browse other questions tagged .