Skip to content
Merged
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,18 @@
var staleDays = 7;
var closeDays = 14;
var reminderGR = new GlideRecord('task');
reminderGR.addActiveQuery();
reminderGR.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@' + staleDays);
reminderGR.query();
while (reminderGR.next()) {
gs.eventQueue('task.reminder', reminderGR, reminderGR.assigned_to, staleDays + ' days without update.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use getters (i.e. getValue('field'))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the advice @SapphicFire

}

var closeGR = new GlideRecord('task');
closeGR.addActiveQuery();
closeGR.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@' + closeDays);
closeGR.query();
while (closeGR.next()) {
closeGR.state = 3; // Closed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be the state value for closed on some task extensions. Additionally, you should use setters (i.e. setValue('field',value))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thanks for the suggestions @SapphicFire

closeGR.update();
}
1 change: 1 addition & 0 deletions Background Scripts/Stale Tasks Auto-Close/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +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.
Loading