Is there a specific handlebar(s) that could be used to format phone numbers? I have phone numbers that come out of my source system as:
1234567890
(123) 456-7890
123-456-7890
I'm wondering if there would be a combination of handlebars I could use to format these preferably to (123) 456-7890
@daveguderian I would probably recommend a javascript function for this due to how complex phone numbers can be. For example, some may have extensions in different ways, country codes, etc. Here is one that works for single digit international codes, 10 digit US, and does not handle extensions.
{{#compare (divide (regexReplace phone2 "" "\D+" "g") "10000000000") ">" "0"}}{{#compare (divide (regexReplace phone2 "" "\D+" "g") "10000000000") "<" "1"}}{{join " " (join " " (join "" (join "" "(" (substring (regexReplace phone2 "" "\D+" "g") 0 3)) ")") (substring (regexReplace phone2 "" "\D+" "g") 3 6)) (substring (regexReplace phone2 "" "\D+" "g") 6 10)}}{{else}}{{#compare (divide (regexReplace phone2 "" "\D+" "g") "100000000000") ">" "0"}}{{#compare (divide (regexReplace phone2 "" "\D+" "g") "100000000000") "<" "1"}}{{join "" "+" (join " " (substring (regexReplace phone2 "" "\D+" "g") 0 1) (join " " (join " " (join "" (join "" "(" (substring (regexReplace phone2 "" "\D+" "g") 1 4)) ")") (substring (regexReplace phone2 "" "\D+" "g") 4 7)) (substring (regexReplace phone2 "" "\D+" "g") 7 11)))}}{{else}}{{/compare}}{{/compare}}{{/compare}}{{/compare}}
Hi,
what if I just want to copy the phone number exactly as it is, from SalesForce to NetSuite?
At the moment, I'm having issues, as the standard mapping is removing any character (spaces, brackets, +, etc.).
The opposite flow, from NetSuite to SalesForce, is working fine.
@alessandrodallavalle are you using the integration app or building your own flows?
@tylerlamparter I'm using the integration app
@alessandrodallavalle I tested this with a platform flow outside of the integration app and it's working as you'd like. The integration app is most likely removing characters to avoid issues with importing to NetSuite and saving you from managing those errors. I'd suggest you make a platform flow to accomplish this.
@tylerlamparter Actually, this behavior with the integration app is creating issues, as I need an option just to copy and paste the number as it is.
This is the scenario:
1) Netsuite: there are existing records, where the phone numbers contain characters and spaces, like (123) 456-7890 or +39 123456789. No issues with these formats.
2) The integration app syncs from NetSuite to SalesForce properly, getting the same phone numbers: (123) 456-7890 or +39 123456789
3) Then, if you make any change in SalesForce, the Integration app syncs back to NetSuite. This time it is removing any character and space, overriding the numbers like this: 1234567890 or 39123456789. This is creating many complains on my team, as it is screwing up existing phone numbers.
So:
- the initial database was ok
- the sync from NetSuite to SalesForce was ok (copy 1:1)
- the sync from SalesForce to NetSuite is not working properly (it's removing the characters and spaces)
I just want the integration app to preserve the existing database, and to make the flow from SalesForce to NetSuite working in the same way as the flow from NetSuite to SalesForce. The default copy should be 1:1, with no additional logic. The Integration app should help me to get this result as standard, with no need to create additional flows in the platform. At the moment, I consider it as a bug.
@alessandrodallavalle given how many errors would occur if you we were to map without changing anything, it is made to strip the phone number into just numbers. We can put an enhancement in the backlog, but the quickest solution will be to make a platform flow. Another option besides a whole new flow would be to map the phone number to a custom text field, then have a workflow or User Event script that runs after the record is submitted and then overrides the native phone field with the value from the custom field.