Masking Phone number

Hi @ismaen

we need some information on phone number partial masking
for example phone number 6 digit should be masked and rest of the 4 digit should be normal.


This gets tricker if you’re trying to implement partial masking in a Phone Input Web Control, but if you’re just looking to display some partially masked phone numbers in a Label, you can handle all of this with some Airscript!

If you know for a fact that you’re only going to be dealing with US-based numbers, you can use something like the following expression, where example_phone is a phone number with 10 expected digits outside of the country code:


This uses the FORMAT_PHONE function to turn the phone number into a string: the phone number without the country code. Then it uses SUBSTRING to pull only the last 4 characters of the returned string and appends “******” to the beginning, to simulate masking.

For masking that works more generally, regardless of the digit conventions of a phone number’s local, you can do clever things using Airscript functions like LENGTH, but the general principle here should be sound.

1 Like

is that working for you? not working for me
its only showing me first 3 numbers

It works for me if I’m displaying phone numbers in a Label! As I said, it’s trickier inside of an input box.

Actually, I’m not sure there’s a good way to do this out-of-the-box. The Secure String Input Web Control can optionally obscure passwords as they’re being written (and store the given data more securely), but it can’t obscure only part of the secure string.

Can you go into a little more detail as to the use case here? Why do you want this displayed in an input box? What part of it is meant to be editable, if you don’t want to show the whole phone number?

@Chandra_Bergmann we want to display in phone input box but if we are trying with an label its working fine but our requirement doesn’t meet that we need to display on phone input box as user will edit the phone input

Hi @tanmay.sardar!

I was able to build out something similar to what you are looking for. Check out this clip!

Here is the attached zip of the app that you can take a look at. (18.0 KB)

So the way this works is by working with the Is Visible property on both the phone input and the contianer that holds the label/edit button. You also want to initialize a boolean variable to control the state of the visibility properties of both the container and the inputs.

Phone input

looks like this. edit_phone is a boolean variable that i created.



This is the expression that i added to the label (taking the airscript @Chandra_Bergmann wrote):

IF(ISNOTEMPTY(phone_input), "******{{SUBSTRING(FORMAT_PHONE(phone_input, "NATIONAL"), 10)}}", NULL)

Edit button

And then lastly, the edit button

Hope this helps!

thanks for reply @ismaen
but we need masked phone number into a phone_input and edit option should be on the same phone input so that we can and it should be formatted also