Notify Assignment Group Manager when Assigned to is inactive

Shankar Manohar
Mega Guru

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

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

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
}
}

View solution in original post

14 REPLIES 14

Hi abhi,

 

 My apologies for responding Late. Your above code working like a charm.

 

Thanks

Shan

Hi could you please  tell me what will be the BR when condition for this. I am using BR after on update

Hi... I have a similar query here: Notify Assignment Group to reassign tickets when assigned to user is inactive. Could you please help me. I am trying this on user table and event and notification is also on user table since BR is after update on sys_user. How it is done for group table.. What will be the BR when condition for using group table. Please visit my query and help me with that.

ronaldanand
Tera Contributor

 

Hi Abinay,

 

I have used the same script and all the stuffs, But I didnt receive Emails i checked Event registry  & Logs , I tried gs.Logs also .

I am getting the results but Emails not triggering ,Please check and help me fix this issue..

 

Reference screen shot also attached below

find_real_file.png

ronaldanand
Tera Contributor

Hi Abinay,

I want to send the  same details to assignment group in CC..Please  help me .

var grGroup = new GlideRecord('sys_user_group');
grGroup.addQuery("manager.active",true);
grGroup.addQuery("active",true);
grGroup.query();
while(grGroup.next()){
var arr=[];
var arr1=[];

    
    var grps = '';
    
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(grGroup.getValue('manager'));
//arr1.push(inc.getValue('number'));
 var assign = inc.assigned_to.name;
arr1.push(assign + ' - ' +inc.getValue('number') + '</br>');    
grps = inc.assignment_group.name;
 //var group1 = inc.getValue('assignment_group');
}
if(arr1.length>1)
{
 gs.eventQueue("inactiveassigntoevent",current,arr,arr1);
    
 }
}