How to calculate Incident state duration (from open to resolved) minus onhold state duration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 07:31 AM
hi
How to calculate incident state duration(from open to resolved) minus onhold state duration using metric table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 07:53 AM
There should already be metric definitions for Incident duration (raw open to closed)
There should already be a metric definition for Incident State.
So you just write a scripted metric definition similar to the OOB Incident Duration one... except this time you isolate ANY state metric_instances for On Hold, sum them up, and subtract them from the Duration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 08:08 AM
Hi Robert
yes, I have tried the similar way (w.r.t 'Create to Resolve Duration' metric definition) but this is not working
please check once.
var s = current.incident_state;
if (s >= 6)
createMetric();
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.time = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
var gr1 = new GlideRecord('incident_metric'); //new lines from here
gr1.addQuery('mi_value=On Hold^inc_number='+current.inc_number);
gr1.query();
if (gr1.next()){
gr.duration = gs.dateDiff(gr.time.getDisplayValue(),gr1.mi_duration.getDisplayValue()); // to here
gr.calculation_complete = true;
gr.insert();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2023 02:01 PM
Hi @Kevin68
I would recommend to not utilize a custom script and not utilizing the metric table, but instead create a SLA/OLA to ensure Start condition, pause condition and stop condition. Furthermore, you need to create the MTTR report through Performance Analytics where you're going to utilize a formula indicator to do the calculation based on the SLA/OLA.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2023 04:40 AM
Hi Anders, the requirement is for the already closed tickets like 3 months old. now configuring SLA will only work new incidents right?