Mask a part of a field for security reasons

Alexander Karam
Mega Contributor

Hi everyone, 

I am just starting out to learn about the platform and I need a bit of help. 

Can anyone tell me how to mask a part of a field for certain users. 

Example: 

If an User inputs his card number (1111-2222-3333-4444), I want to make it so that a non-admin user sees the field masked in the following way (****-****-****-4444). 

Can anyone help me in regards to what is the best way to do this. 

Thank you !  

1 ACCEPTED SOLUTION

oh, i see

what is the requirement for masking? do you need to mask while user typing it? (high risk, user might mistype the numbers) or after submit?

if the latter, i would do following:

1) add client script onchange for the field to format user's input in the format you need, so if user typing 1234555511112222, you script formats it 1234-5555-1111-2222

2) create business rule on insert/update and just have the masked field update as below

 

var maskedPrefix="****-****-****-";

current.yourfieldmasked = maskedPrefix + current.userinputfield.toString().slice(-4);

what do you think?

View solution in original post

6 REPLIES 6

Andrew_TND
Mega Sage
Mega Sage

Hi Alex are you looking to make the field blank or are you looking for the effect of '******'.

Easiest way around if you've got the admin access would be to do an access control,

Go to access controls,

Operation: read
Role: //add the role/s you want it to be exclusive to and save.

And then a second one using the same process for write. 

This will basically make it as though its not there at all only to the people with the specific roles.

Ensure you also have the security admin role. 

Please mark as helpful or if its resolved the issue mark as correct!

Hi Andrew, 

Thanks for the reply ! 

I specifically need the field to be masked with "****-****-****-". 

I believe the solution provided by Nataliya is the correct one and will work for me. 

Thank you very much and have a nice day !