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 01:58 AM
so it's not working for date variable?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 01:59 AM
yes working only for variable which is string type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 04:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 04:51 AM
Haven't tried it but did you try to use DOM manipulation on client side?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader