Skip to content

added notifications script #1600

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

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
7 changes: 7 additions & 0 deletions TaskNotifications/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Enhanced Task Reminder Notification

This script sends a daily reminder notification to users who have overdue tasks. It helps ensure tasks are completed on time and improves accountability.

## Usage
- Place this script in a Script Include or schedule it as a daily background job.
- Customize the query in `task.addEncodedQuery` for different conditions if needed.
19 changes: 19 additions & 0 deletions TaskNotifications/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(function executeReminder() {
// Query for overdue tasks
var task = new GlideRecord('task');
task.addEncodedQuery('due_date<javascript:gs.now()^state!=3');
task.query();

// Send reminder notification to task owner
while (task.next()) {
var userSysId = task.assigned_to.sys_id;
if (userSysId) {
var grNotification = new GlideRecord('sysevent_email_action');
grNotification.initialize();
grNotification.setValue('recipients', userSysId);
grNotification.setValue('subject', 'Reminder: Task Overdue');
grNotification.setValue('body', 'Please review and complete your overdue tasks.');
grNotification.insert();
}
}
})();
Loading