How to find incidents that were resolved or closed without going on hold
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2024 08:14 AM
How to find incidents that were resolved or closed without going on hold
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2024 08:59 AM
@Snehal13 You can follow below steps
1) Create metric definition which will create metric instance when incidet went onhold.
2) In your script check if there is at least one metric instance created for onhold and current state is either resolved or closed.
Else
Create one new field and store all the state values which ever incident is moving like 2,3,4 and in your script check if this field contains on-hold state value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2024 09:29 PM
I get that but want to know details on points 1 and 2 mentioned above everyone is only saying metric and script but not diving into the details of it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2024 09:59 AM - edited ‎10-29-2024 10:03 AM
You can add this in a background script or use it as part of a script to retrieve incidents:
var incidentGR = new GlideRecord('incident');
incidentGR.addEncodedQuery('stateIN6,7'); // Fetch Resolved (6) and Closed (7) incidents
incidentGR.setLimit(5); // Limit to 5 records
incidentGR.query();
while (incidentGR.next()) {
// Check the sys_audit table to confirm the incident never had an "On Hold" status
var auditGR = new GlideRecord('sys_audit');
auditGR.addQuery('documentkey', incidentGR.sys_id); // Link audit records to the incident
auditGR.addQuery('fieldname', 'state'); // Only check state changes
auditGR.addQuery('oldvalue', '3'); // '3' generally represents "On Hold"
auditGR.setLimit(1); // Efficiency: Only need one match to confirm "On Hold"
auditGR.query();
if (!auditGR.hasNext()) { // If no "On Hold" state was found in the audit history
gs.print(incidentGR.number + ' was resolved or closed without being on hold.');
}
}
But check with your architects, if gliding audit table is allowed and acceptable in your environment. This is a lighter, on-demand solution, not a permanent one.
happy to help 🙂 Mark correct if the answer works for you. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2024 09:49 PM
This might be a step too far but you can try if performance analytics for itsm is available to you and you might find your answer there. Maybe there are existing out of the box dashboards or KPIs too