Skip to main content
Liaison

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:

  1. Find and select the CAS Contact Information - Phone form from the Available Fields area.

    contact-information-form-export.png
  2. In the Pivot Table window that opens, click number to select this as the field you wish to include from this array.
  3. 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.

    click-functions-icon-number-export.png
  4. Copy the following code into the Expression field:
row?.number?.replace('(','').replace(')','').replace('-','').replace('-','').replace(/\s+/g, '')
  1. Click Update to save your work.
  2. From the Pivot Table window, click the phone number of your choice from the left side.

    add-preferred-phone-export-function.png
  3. Click Update to keep these settings.
  4. Continue configuring your export as desired, and click Create Export when ready.
  • Was this article helpful?