Skip to content

Commit 99a9a56

Browse files
authored
Proactive Change Reminder Scheduled Job (#2242)
* Create proactive_change_reminder.js This commit adds a Scheduled Script that proactively notifies assigned agents of Priority 1 Change Requests due within 24 hours. * Create README.md
1 parent 0d9e202 commit 99a9a56

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**Proactive Change Request Reminder (Due in 24 Hours)**
2+
3+
**Description**
4+
This Scheduled Job sends an automated email reminder to the assigned agent of each Priority 1 Change Request that is due within the next 24 hours.
5+
It helps teams stay ahead of deadlines, prevent SLA breaches, and ensure timely change implementation.
6+
7+
**When to Use**
8+
Use this script to ensure that high-priority change requests are addressed on time by proactively notifying assigned engineers.
9+
10+
**How It Works**
11+
Checks all active change_request records with:
12+
- priority = 1
13+
- state not in "Closed" or "Complete"
14+
- due_date within the next 24 hours
15+
Sends an email reminder to the assigned agent with the change number, description, and due date.
16+
17+
**Scheduled Job Configuration**
18+
Recommended schedule:
19+
- Run: Periodically
20+
- Repeat interval: 1 hour
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//Get current time and time after 24 hours
2+
var now = new GlideDateTime();
3+
var after24Hours = new GlideDateTime();
4+
after24Hours.addSeconds(24 * 60 * 60);
5+
6+
//Query for high-priority Change Requests due within 24 hours which are not closed or complete
7+
var gr = new GlideRecord('change_request');
8+
gr.addQuery('priority', 1);
9+
gr.addQuery('state', 'NOT IN', '3,4');
10+
gr.addQuery('due_date', '>=', now);
11+
gr.addQuery('due_date', '<=', after24Hours);
12+
gr.query();
13+
14+
while (gr.next()) {
15+
var assignedTo = gr.assigned_to.getRefRecord();
16+
if (assignedTo && assignedTo.email) {
17+
//Email reminder
18+
var mail = new GlideEmailOutbound();
19+
mail.setSubject('Proactive Reminder: ' + gr.number + ' is due within 24 hours');
20+
mail.setBody(
21+
'Hi ' + assignedTo.name + ',\n\n' +
22+
'This is a reminder that the following Change Request is due within the next 24 hours:\n\n' +
23+
'Change Request: ' + gr.number + '\n' +
24+
'Short Description: ' + gr.short_description + '\n' +
25+
'Due Date: ' + gr.due_date.getDisplayValue() + '\n\n' +
26+
'Please review and take the necessary actions.'
27+
);
28+
mail.addAddress('to', assignedTo.email);
29+
mail.send();
30+
}
31+
}

0 commit comments

Comments
 (0)