- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2020 10:29 AM
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 !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 07:38 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2020 05:13 PM
I would have two fields for this: one for admin with clear user's input and second with partially masked data. Check if user has an admin role - show both- actual and masked, for non admin - show masked data field. The ACLs for these fields could be used for read access for admin/nonadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 12:44 AM
Greetings Nataliya,
Thank you for the reasponce, that is a great idea regarding the visibility and using 2 fields.
My main issue however is how to actually mask a field in service now. Is there any build in functuonality I can use or does it have to be scripted.
Thank you in advance!
Have a wonderful day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 07:38 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2020 11:55 PM
Hi Nataliya,
To answer your question it is the latter and I believe the solution you provided here is exactly what I asked for / need.
Thank you so much for your help !
Have a lovely day !