-
Notifications
You must be signed in to change notification settings - Fork 679
Stale Tasks Auto-Close #1564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stale Tasks Auto-Close #1564
Changes from all commits
ec25326
2ef3e17
20569ab
d310046
4be2fc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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.'); | ||
} | ||
|
||
var closeGR = new GlideRecord('task'); | ||
closeGR.addActiveQuery(); | ||
closeGR.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@' + closeDays); | ||
closeGR.query(); | ||
while (closeGR.next()) { | ||
closeGR.state = 3; // Closed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure thanks for the suggestions @SapphicFire |
||
closeGR.update(); | ||
} |
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. |
There was a problem hiding this comment.
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')
)There was a problem hiding this comment.
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