Using a Parser to normlize phone numbers from Portal

Following data builder docs, I’m trying to normalize the format of phone numbers that come via portal. The data type of the field is phone and I’m adding the following expression as Parser:

PARSE_PHONE(
  @,
  "US"
)

My expectation is the following: user pastes a phone number string (555 555 5555) and it’s correctly converted to +15555555555 and stored that way in the data store. But when I tested it, simply my input wasn’t accepted.

Thanks!

Hey @nico ! If the field in your AirData table is of type Phone I’d recommend trying with (replace the number with @

FORMAT_PHONE(
  "555 555 5555",
  "E164",
  "US"
)

Keep in mind that a 10-digit phone number without any country code could potentially be resolved to a number of regions, in which case the PARSE_PHONE() function will return null.

A couple of things to keep in mind here is that when pasting data into a Portal Data Grid, the fields will expect the data to already be of the same Datatype as the AirData table’s field.

Can you share the Datatype of your phone field in Data Builder and what you are expecting as valid inputs from your agents/users?

Thanks Juana, suggested solution worked as expected.

Also field Data Type is phone in Data Builder, so the snippet does the work correctly.

2 Likes

That’s awesome @nico, glad it helped!

1 Like