Best Practice to display SLA Business Time Left in a column from Incident List View.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 11:15 PM
Request: MGMT wants ITIL users to have an "SLA DUE" column that updates regularly from the Incident List View.
Example:
Context:
Around 200-300 "Active" incidents at any time (excluding resolved/closed/cancelled).
Each incident has 1 active SLA (occasionally 2-3, with extras being in the cancelled state).
SLAs are based on Service/Subcategory, not priority.
SN implemented by a third party; I'm the sole SN Admin with ~2 months of experience and no prior development background, learning in my spare time.
Inquiry: Seeking guidance for efficiently updating an 'SLA DUE' column in near real-time. In our dev instance, a scheduled job updating every 5 minutes worked well (ran it for weeks). However, in prod, the same script running at 4-minute intervals sometimes lagged to 8 minutes, with what I suspect are high SQL and Business Rule counts.
Script:
var incidentGR = new GlideRecord('incident');
// Query to exclude incidents where status is resolved, closed or cancelled
incidentGR.addQuery('state', 'NOT IN', '6,7,8');
// Query the filtered records
incidentGR.query();
while (incidentGR.next()) {
var taskSLAGR = new GlideRecord('task_sla');
taskSLAGR.addQuery('task', incidentGR.sys_id); // Query SLAs related to the incident
taskSLAGR.addActiveQuery(); // Select only active SLAs
taskSLAGR.orderByDesc('sys_updated_on'); // Order by last updated to get the most recent active SLA
taskSLAGR.setLimit(1); // Ensure only one SLA is processed
taskSLAGR.query(); // Execute query
// Update the 'u_sla_due' field with the 'business_time_left' value
if (taskSLAGR.next()) {
incidentGR.u_sla_due = taskSLAGR.business_time_left; // Assign the duration value directly
incidentGR.update(); // Commit the update
}
}
Key Questions:
- What is the most effective approach for near real-time updates without impacting performance?
- Should the irregular intervals and high SQL/BR Rule counts in the prod instance be a concern?
Any insights or suggestions to balance management's request for real-time updates with system performance, given my limited SN experience, would be highly appreciated.
Prod Log:
Dev Log: