Event param - Can I send a list of users?

kristenankeny
Tera Guru

For our SLA warning/breach emails, they want us to send the notification to a sub-set of people within the assignment group and the assignee. I have identified the people who should receive the SLA emails by adding a flag to the sys_user_grmember table (u_sla_escalation) and setting it to true for the appropriate people within the group. what is the best way to grab these people to send them the SLA emails? I was thinking I would parse through the group members to find them and pass a string of the sys_ids (comma separated) in one of the event parameters. Would this work? Examples of event params I found in the documentation only show a single user.

1 ACCEPTED SOLUTION

ananthagowraram
Mega Expert

Hi Kristen,



Yes you can acheive this using below code



var userList = [];  


var userRec = new GlideRecord("sys_user_grmember");  


userRec.addEncodedQuery(YOUR-ENCODED-QUERY); // this should have filter to assignment group and the user has the checkbox true  


userRec.query();  


while (userRec.next()) {  


      if (userList.toString().indexOf(userRec.sys_id) == -1) {  


userList.push(userRec.sys_id + "");  


    }  


}  


gs.eventQueue("EVENT-NAME", current, userList.toString());



Regards


Anantha Gowraram


View solution in original post

2 REPLIES 2

ananthagowraram
Mega Expert

Hi Kristen,



Yes you can acheive this using below code



var userList = [];  


var userRec = new GlideRecord("sys_user_grmember");  


userRec.addEncodedQuery(YOUR-ENCODED-QUERY); // this should have filter to assignment group and the user has the checkbox true  


userRec.query();  


while (userRec.next()) {  


      if (userList.toString().indexOf(userRec.sys_id) == -1) {  


userList.push(userRec.sys_id + "");  


    }  


}  


gs.eventQueue("EVENT-NAME", current, userList.toString());



Regards


Anantha Gowraram


Thanks for the guidance!