Trigger notification to manager when user is inactivated and still assigned to active tasks

cynlink1
Tera Expert

When a user is inactivated but still assigned to active tasks of any type, we want to spend the manager a notification containing a list of the active tasks. What would be the easiest (best) way to accomplish this requirement?

 

 

1 REPLY 1

Nayan  Dhamane
Kilo Sage
Kilo Sage

Hello @cynlink1 ,

 

Please write an 'on after' business rule on user table. Confition to trigger is active changes to false.

and write the below script inside the business rule

 

var arr=[];

var task = new GlideRecord('task');

task.addQuery('assigned_to',current.sys_id);

task.query();
while(task.next()){

arr.push(task.getDisplayValue());

}

if (arr.length!=0){

gs.eventQueue('event name',current,current.sys_id,arr.toString())

}

 

 

Then create an event and mention the same in notification and also call the event parameter 2 in your notification to access the list of task.

 

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.