Masking variables in incident using business rule script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 01:35 AM
I have created a business rule to mask the variables in incident variable editor when submit a record producer.
(function executeRule(current, previous /*, gs*/) {
var variablesToMask = ['variable1', 'variable2', 'dob'];
for (var i = 0; i < variablesToMask.length; i++) {
var variableName = variablesToMask[i];
if (current.variables[variableName]) {
current.variables[variableName] = '********';
}
}
})(current, previous);
I am getting output like this,
The date of birth variable type is "Date" I also need to mask that,
Some modification is needed in that script. Please guide me with that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 04:58 AM
DOM manipulation is not recommended in our instance. so we are not using it. Please help with the above business rule script. It will be helpful
Regards
Faiz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 05:01 AM
I don't think it will work then since you already have that BR script and logic in place.
Why not hide that field using client script or UI policy as you are planning not to show data for it?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader