Skip to content

Commit 5596b2b

Browse files
authored
script.js
1 parent 599f55e commit 5596b2b

File tree

1 file changed

+17
-0
lines changed
  • Server-Side Components/Scheduled Jobs/Auto-Reassign Stale Incidents to Group Manager

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var grInc = new GlideRecord('incident');
2+
grInc.addQuery('state', 2); // 2 = In Progress
3+
grInc.addQuery('sys_updated_on', '<=', gs.daysAgoStart(7));
4+
grInc.query();
5+
6+
while (grInc.next()) {
7+
if (!grInc.assignment_group)
8+
continue;
9+
10+
// Find the group manager
11+
var group = new GlideRecord('sys_user_group');
12+
if (group.get(grInc.assignment_group) && group.manager) {
13+
grInc.assigned_to = group.manager;
14+
grInc.work_notes = 'System: Reassigned to group manager : "+group.manager+"due to inactivity (15+ days).';
15+
grInc.update();
16+
}
17+
}

0 commit comments

Comments
 (0)