Masking variables in incident using business rule script

FaizDev101
Tera Expert

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,

FaizDev101_0-1695630663662.png

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.

6 REPLIES 6

@Ankur Bawiskar 

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

@FaizDev101 

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?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader