Skip to main content

Notifications

Power Automate - Format Phone Number Easy

Jcook Profile Picture Jcook 7,770

Scenario:

We have a phone number coming in from a secondary system as a integer number. We than want to add some formatting to this to be easily read and look cleaner. For example, a phone number comes in like this:
4035557890 And make it look like (403)-555-7890

 

Things to Know:

Since we add '-' and '( )' this turns our data type to become an String. Keep this in mind, since you wont be able to pass this into a field in another system that is looking for a Integer value

 

The Flow:

This Flow is very simple. To achieve the formatted number I am using the action 'Format number'. This is a fairly new connector that is mainly used to format currency values. But we can utilize the format to define any formatting we want.

flow

 

Looking at the above picture, we are passing a Integer phone number into the Format number action. Than we specify the format we want to use by selecting the drop down > clicking 'Enter custom value'

customvalue

 

End Result!

successflow1

 

Conclusion:

Since this action is fairly new, I am curious and looking forward to see if the Power Automate team will expand and add more actions like this to make formatting a breeze.

 

Post originally from:

https://flowaltdelete.ca/2020/07/02/power-automate-format-phone-number-easy/

 

Thanks for reading!

Comments

*This post is locked for comments

  • HeidiN Profile Picture HeidiN 34
    Posted at
    Power Automate - Format Phone Number Easy

    Interesting post! If you're using CDS or Dynamics 365/a model-driven or canvas app, this sort of thing can be applied effortlessly at the field level. Simply apply an input mask on the field and VOILA! Here's a blog I've written about how to apply the input mask if it makes sense for others to use: https://reenhanced.com/2020/setting-up-the-input-mask-ui-control-in-dynamics-365/

  • Expiscornovus Profile Picture Expiscornovus 30,049
    Posted at
    Power Automate - Format Phone Number Easy

    Hi @Jcook,

     

    Thanks for sharing this blog. Very easy action (Format Number) to use.

     

    Maybe it's also useful to add that you can achieve a similar thing with an expression like this:

    formatNumber(variable('PhoneNum'), '(###)-###-####')