Skip to content

Commit 4a04f68

Browse files
authored
Stale Tasks Auto-Close (#1564)
* Add files via upload * Delete Background Scripts/encryptAndDecryptPasswordFields.js Deleting duplicate file * Delete Background Scripts/readme.md Deleting duplicate file * Create Stale Tasks Auto-Close.js The script identifies tasks that haven’t been updated for a set period, sends reminder notifications to assigned users, and, if still inactive after additional time, automatically closes them. This helps keep task lists current and reduces manual follow-ups. * Stale Tasks Auto-Close The script identifies tasks that haven’t been updated for a set period, sends reminder notifications to assigned users, and, if still inactive after additional time, automatically closes them. This helps keep task lists current and reduces manual follow-ups.
1 parent c8195b3 commit 4a04f68

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var staleDays = 7;
2+
var closeDays = 14;
3+
var reminderGR = new GlideRecord('task');
4+
reminderGR.addActiveQuery();
5+
reminderGR.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@' + staleDays);
6+
reminderGR.query();
7+
while (reminderGR.next()) {
8+
gs.eventQueue('task.reminder', reminderGR, reminderGR.assigned_to, staleDays + ' days without update.');
9+
}
10+
11+
var closeGR = new GlideRecord('task');
12+
closeGR.addActiveQuery();
13+
closeGR.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@' + closeDays);
14+
closeGR.query();
15+
while (closeGR.next()) {
16+
closeGR.state = 3; // Closed
17+
closeGR.update();
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The script identifies tasks that haven’t been updated for a set period, sends reminder notifications to assigned users, and, if still inactive after additional time, automatically closes them. This helps keep task lists current and reduces manual follow-ups.

0 commit comments

Comments
 (0)