Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//Auto-Reassign Stale Incidents to Group Manager

//Use Case:
Automatically reassigns incidents that haven’t been updated for 15+ days to their Assignment group manager.

//Logic :
Runs daily at midnight (12AM CST)
Finds all incidents with:
State = In Progress
No updates for 15 or more days.
Reassigns to the 'manager' of the assignment group.
Adds a system work note.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var grInc = new GlideRecord('incident');
grInc.addQuery('state', 2); // 2 = In Progress
grInc.addQuery('sys_updated_on', '<=', gs.daysAgoStart(7));
grInc.query();

while (grInc.next()) {
if (!grInc.assignment_group)
continue;

// Find the group manager
var group = new GlideRecord('sys_user_group');
if (group.get(grInc.assignment_group) && group.manager) {
grInc.assigned_to = group.manager;
grInc.work_notes = 'System: Reassigned to group manager : "+group.manager+"due to inactivity (15+ days).';
grInc.update();
}
}
Loading