How to replace a space with a hyphen in workflow?

Hi,
I would like to change the format for my telephone no. (eg. xxx xxx xxxx to xxx-xxx-xxxx)

I tried to use Calculate Fields in workflow, but it doesn’t work Here is what I did:

Parameters
Phone Number Raw value {P0}

Formulas
Field name Formula
Phone Number
{replace( ;-; {P0})}

Is there something wrong with my formula?

Thank you very much

Hey there,

I’ve been giving it a try on a local instance, and it seems like it might just be a current limitation of the Calculated Fields functionality…

Looks like it doesn’t have a way to differentiate a space that is used as a value, or a space that is used as formatting

I’ve also tried it by trying to escape HTML Entities such as “\ ”, but with no luck

Perhaps another user has some ideas as to how to get around this?

It would be worth raising on the Github project as a suggested enhancement, though


Though, in the meantime, it might be worth looking into Logic hooks
If you have access to the Code, then you would be able to build a quick logic hook that would be capable of replacing the spaces with dashes

Let me know if you want to pursue this, if you need any assistance :slight_smile: