If specific user from group get inactive then assign all incidents to his manager so that he will further can assign to available member from group.

micky09
Tera Contributor

If specific user from group get inactive then assign all incidents to his manager so that he will further can assign to available member from group.

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

You can write a business rule on user table 

after / update

condition: active changes to false

Script: 

var gr = new GlideRecord('incident');

gr.addQuery('active', true);

gr.addQuery('assigned_to.sys_id', ''+current.sys_id);

gr.setWorkflow(false);//use this if you dont need any BRs to trigger , else dont

gr.query();

while(gr.next())

{

gr.assigned_to=current.manager;

gr.update();

}

 

-Anurag Tripathi

 

Please mark my answer correct/helpful if it solved your issue.

-Anurag

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

You can write a business rule on user table 

after / update

condition: active changes to false

Script: 

var gr = new GlideRecord('incident');

gr.addQuery('active', true);

gr.addQuery('assigned_to.sys_id', ''+current.sys_id);

gr.setWorkflow(false);//use this if you dont need any BRs to trigger , else dont

gr.query();

while(gr.next())

{

gr.assigned_to=current.manager;

gr.update();

}

 

-Anurag Tripathi

 

Please mark my answer correct/helpful if it solved your issue.

-Anurag

Hey Mate, did you try this? 

If you dont need anything else then please close this thread by marking an answer correct.

-Anurag

Sunil B N
ServiceNow Employee
ServiceNow Employee

Hi Micky,

1. Create Business rule on Update and when active changes to false.
2. Code to re-assign all active incidents at once.

var gr = new GlideRecord('incident');
gr.addQuery('active', true);
gr.addQuery('assigned_to', current.getUniqueValue());
gr.setValue('assigned_to', current.manager);
gr.updateMultiple();

Cheers,
Sunil B N