Duration of a request item

Christina Jesse
Tera Contributor

What parameters should I use to produce a report for average duration of a request item.  I have found a report on the benchmark dashboard but I need to create reports within ServiceNOW and add them to a Dashboard for our exec leadership team.

3 REPLIES 3

JP - Kyndryl
Kilo Sage

Hi Christina,

If you need a single score report (average of the RITM's time) like this:

find_real_file.png

You will then need to create a Metric Definition (admin role required).

Here is an example:

find_real_file.png

And here is the script:

var s = current.active;
if (s == false)
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.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}

 

This will then create records in the metric_instance table every time a RITM is closed, calculating the time from Open to Close.

You can then create a report on the metric_instance table.  If you need to filter which RITMs will be in that report,  you will then need to create a Database View combining the metric_instance and the sc_req_item table, only for the metric definition = "Create to Close Duration".  An example of this is the incident_metric database view, for incidents.

 

 

Regards,
JP

GT4
Tera Contributor

I am getting the same request and I was able to follow the instructions you provided for the single score report. I haven't been able to populate the "Duration" time from the Metric Definition to the Requested Item table so I can report on sc_req_tem table for duration time. Do you know how this can be achieved?

Sebas Di Loreto
Kilo Sage
Kilo Sage

The solution from JP is right AND on the metric_instance table.

That table can be huge since it has all the metrics from all tasks (incident, ritms, etc.).

In addition, in your report you WON'T be able to add fields from the task since you can't dotwalk back to it.

Type "database view" on the left nav and get familiar with it. Add this to your instance to visualize the DB view called "sc_req_item_metric": /sys_db_view.do?sys_id=60070b27c0a8016600e92d309cf60fcb

This DB view combines all fields from the ritm record (task) PLUS the records from the actual metric, which most likely you want the duration field. Remember to add condition to filter the metric that you actually want to calculate the average ("Create to Close duration").

Hope this helps.

 


If I helped you with your case, please click the Thumb Icon and mark as Correct.