Notifying group/assignee when RITM commented

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 06:18 AM
Good afternoon all
We have a number of catalogue items that generate change requests, and we would like to notify the assignment group/assignee when the RITM is commented. I have the following business rule which works fine when the assigned to is populated:
(function executeRule(current, previous /*null when async*/) {
var email_to =[];
var chg = new GlideRecord('change_request');
chg.addQuery('parent',current.sys_id+'');
chg.query();
while (chg.next()){
if (chg.assigned_to){
email_to.push(chg.assigned_to);
}
}
gs.eventQueue("change.commented", current, email_to.join(), gs.getUserName());
})(current, previous);
I need to know how to add an else{} statement to this script which will convert the assignment group members to a string and email them all if the change is unassigned. I have tried the following, but its not working:
else{
var list = current.assignment_group.u_managers.toString();
var listArr = list.split(',');
for (var i=0;i<listArr.length;++i) {
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',listArr[i]);
user.query();
if(user.next()){
email_to.push(user.sys_id.toString());
}
Any help greatly appreciated.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 09:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 01:39 AM