
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2015 04:48 AM
Greetings!
I'm posting because I'm certain this data has to have been collected by some of you out there. I've several ideas in my head, but why reinvent the wheel if I poll you all?
So, what we need is the and that is the current state duration. We are using the standard metrics to pull how long an Incident was in each state in the past, however the data we are missing is being able to report how long Incidents have been sitting in the state they are currently in. Up to this point, we've been exporting the data and creating our own reports to calculate the duration from which the Incident was last updated to the current date, which is less than ideal.
Any thoughts/suggestions on how we can accomplish this?
Many thanks! Amy
Solved! Go to Solution.
- Labels:
-
Analytics and Reports
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2015 11:21 AM
This can come with a bit of load consequence, but its the only way I know of to accomplish it.
We had a similar requirement. They wanted all active calculations to be "as up to date as possible" rather than being null until the calculation completed.
I created a scheduled job that runs every 12 hours. It checks all Metric Instances where calculation_complete = false and updates their duration field. If I were to do it over again, I might add a field to the Metric Definition table which governs whether or not we want the metric instances caught in this script (its essential for some metrics, but not for others).
Scheduled Job: "Update Continuous Duration Metrics"
var inst = new GlideRecord("metric_instance");
inst.addQuery('definition.type','field_value_duration');
inst.addQuery('calculation_complete',false);
inst.query();
while(inst.next()){
inst.duration = gs.dateDiff(inst.start.getDisplayValue(), gs.nowDateTime());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 10:15 AM
Start a new thread and I'll answer the question there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 11:34 AM
Hi Robert, i started a new thread here:
https://community.servicenow.com/community?id=community_question&sys_id=525d4147dbb2c8d813b5fb2439961935
thanks again