Calculating Time in Open and Work in Progress State
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 08:55 AM
I have been tasked with creating metrics for measuring the length of time a ticket is in the "open" state "work in progress" state, and "pending" state. I see there is an out of box metric for calculating the length of time a ticket is in "pending". Is there a way to calculate "open" and "work in progress" as well? Thanks!
- Labels:
-
Performance Analytics
-
Reporting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 09:03 AM
Hello
Yes, it is possible using metrics "Script Calculation" type. PFB screen shot for incident with work in progress state.
Similarly you can create for open state as well.
If my answer helped you in any way, please then mark it as Correct and helpful.
Regards,
Akshay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 09:55 AM
Updated -
Hi again
Sorry I forgot to paste source code. Here it is -
var s = current.incident_state;
if (s == 2) // if state is In Progress
createMetric();
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.value = current.incident_state.getDisplayValue();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
,
Regards,
Akshay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 07:30 AM
Hey
Didn't hear back on this.
Is your issue resolved by my answer? If yes, feel free to mark correct as well, so it will be helpful for others looking for similar query.
If not let us know your issue so we can help you.
Thanks
Akshay Kangankar