
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2018 09:12 AM
Dear All,
I need to notify the Assignment group Manager every week once when the assigned to member of that group is inactive.
I tried using a scheduled job with a script and the events. However, the notifications is not getting triggered at all.
Any suggestions would be of great help.
Thanks
Shan
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2018 12:41 PM
Try this code. Now the event and notification should be on group table
var grGroup = new GlideRecord('sys_user_group');
grGroup.addQuery("manager.active",true);
grGroup.addQuery("active",true);
grGroup.query();
while(grGroup.next()){
var arr=[];
var inc= new GlideRecord("incident");
inc.addQuery('assigned_to.active',false);
inc.addQuery('assignment_group',grGroup.getValue('sys_id'));
inc.addQuery('incident_state','NOT IN','6,7');
inc.query();
while(inc.next())
{
arr.push(inc.getValue('number'));
}
if(arr.length>1){
gs.eventQueue("inactiveassigntoevent",grGroup,grGroup.manager.email,arr.join()); //here 4th parameter has comma separated incidents that are assigned to inactive users
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2018 09:19 AM
Please post the code you have. I will edit the code

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2018 11:02 AM
Hi Abhinay,
Please see my Scheduled Job Script below. Let me know If am doing anything wrong.
var grGroup = new GlideRecord('incident');
grGroup.addQuery('assigned_to.active',false);
grGroup.addQuery('assignment_group.manager.active',true);
grGroup.addQuery('assigned_to.active',false);
grGroup.addQuery('incident_stateNOT IN6,7');
grGroup.query();
while(grGroup.next())
{
gs.eventQueue("inactiveassigntoevent",grGroup,grGroup.assignment_group.manager.email);
gs.log('inactive user');
}
In my email notification, I am calling the above event I created.
Thanks
Shan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2018 12:19 PM
Here you go. Now the event and notification should be on group table
var grGroup = new GlideRecord('sys_user_group');
grGroup.addQuery("manager.active",true);
grGroup.addQuery("active",true);
grGroup.query();
while(grGroup.next()){
var arr=[];
var inc= new GlideRecord("incident");
inc.addQuery('assigned_to.active',false);
inc.addQuery('assignment_group',grGroup.getValue('sys_id'));
inc.addQuery('incident_state','NOT IN','6,7');
inc.query();
while(inc.next())
{
arr.push(inc.getValue('number'));
}
if(arr.length>1){
gs.eventQueue("inactiveassigntoevent",grGroup,grGroup.manager.email,arr.join()); //here 4th parameter has comma separated incidents that are assigned to inactive users
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2018 11:14 AM
Here you go. And also make sure your event is registered on incident table and notification is on incident table
var grGroup = new GlideRecord('incident');
grGroup.addQuery('assigned_to.active',false);
grGroup.addQuery('assignment_group.manager.active',true);
grGroup.addQuery('incident_state','NOT IN','6,7');
grGroup.query();
while(grGroup.next())
{
gs.eventQueue("inactiveassigntoevent",grGroup,grGroup.assignment_group.manager.email);
gs.log('inactive user');
}