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

Community Alums
Not applicable

Amit Pandey
Kilo 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