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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 10:30 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 11:30 PM
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.
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.