We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How many users opened one incident and how get users list

Ajay gadudasu
Tera Contributor

How many users opened one incident and how get users list

2 REPLIES 2

Not applicable

Amit Pandey
Mega Sage

Hi @Ajay gadudasu 

 

You can create a list field on the form and use display business rule to save those users in the list. An outline of the Display BR is as follows-

 

(function executeRule(current, previous /*null when async*/ ) {
if (current.isNewRecord())
return;
var currentUser = gs.getUser().getID();
var oldusers;

oldusers = current.u_incident_viewers; //List field to store 
var user = oldusers.split(',');

var i;
for (i = 0; i < user.length; i++) {
var old = user[i];
if (old == currentUser) {
return;
}
}
current.u_list_viewers += ',' + currentUser;
current.update();

})(current, previous);

Please mark my answer helpful and correct.

 

Regards,

Amit