Remove Extra Characters from Phone Numbers
When extracting data from Outcomes, you may need to strip extra characters from a string of numbers. For example, the system you're importing data into may require you to remove dashes and parentheses from phone numbers. Using this advanced configuration, you can strip the following characters from a phone number, leaving just the numeric characters:
- Parentheses
- Extra spaces
- Dashes
Select the Phone Number Field
To apply this configuration, you'll first need to add the phone number field to your export. This expression works with the number field in the CAS Contact Information array. To select and customize this field:
- Find and select the CAS Contact Information - Phone form from the Available Fields area.
- In the Pivot Table window that opens, click number to select this as the field you wish to include from this array.
- In the Include area, click the function icon on the number field. A Field Expression window opens, allowing you to use a JavaScript expression in this field.
- Copy the following code into the Expression field:
row?.number?.replace('(','').replace(')','').replace('-','').replace('-','').replace(/\s+/g, '')
- Click Update to save your work.
- From the Pivot Table window, click the phone number of your choice from the left side.
- Click Update to keep these settings.
- Continue configuring your export as desired, and click Create Export when ready.