Skip to content

added custom sla breach script #1601

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 SlaBreach/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Custom SLA Breach Alert

This script monitors SLAs and sends a notification to assignees if an SLA is about to breach within the next hour. It allows users to take preemptive action to meet SLA commitments.

## Usage
- Place this script in a Script Include or scheduled job to monitor SLA breaches.
- Customize the query for different SLA thresholds.
16 changes: 16 additions & 0 deletions SlaBreach/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(function alertSLABreach() {
// Query for tasks with SLAs nearing breach within 1 hour
var sla = new GlideRecord('task_sla');
sla.addEncodedQuery('breach_timeRELATIVELE@hour@1');
sla.query();

// Send alert notification
while (sla.next()) {
var taskNumber = sla.task.number;
var assignedUser = sla.task.assigned_to;

if (assignedUser) {
gs.eventQueue("custom.sla.breach.alert", sla.task, assignedUser, taskNumber);
}
}
})();
Loading