Unassigned Duration per Assignment Group - Metric Definition values

Elizabeth10
Tera Contributor

I understand from a servicenow video, that this Metric Definition: Unassigned Duration per Assignment Group is OOTB. But I can't see it in our instances. Can someone please let me know the values set for all fields/scripts etc for this metric definition, so I can create it myself? 

1 ACCEPTED SOLUTION

I was able to figure it out! This community post reply by Harish Murikina was very helpful. https://www.servicenow.com/community/itsm-forum/metric-to-measure-time-before-unassigned-ticket-is-a... . You just create a new metric definition called "Unassigned Duration" or something like that. Use whatever table you are reporting on, select "Assigned to" as the field. Then, select Script Calculation as the type and paste the following script:

 

 

if (current.assigned_to != '')

  {

  var value = false;

  if (!current.active)

  value = true;

  createMetrice(value);

}

 

function createMetrice(value) {

  var mi = new MetricInstance(definition, current);

  if (mi.metricExists())

  return;

  var gr = mi.getNewRecord();

  gr.field_value = value;

  gr.start = current.sys_created_on;

  gr.end = gs.nowDateTime();

  gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());

  gr.calculation_complete = true;

  gr.insert();

}

View solution in original post

8 REPLIES 8

The Machine
Kilo Sage

Take a look in your PDI. It should be there if it’s OOB. 

It wasn't.

The next part of the question was does anyone have that metric set up and if so , could they share the settings/values/scripts`? 🙂

I agree, I don't have it in my PDI.... I am on Xanadu and can't find it anywhere.. 

AmberTemple
Tera Guru

I think I saw the same video and was wondering the same thing. I watched "Indicators on Metrics - Jan 27, 2021 - Performance Analytics Academy". I can't find it in my PDI either. Were you ever able to figure it out?