Metric to measure time before unassigned ticket is assigned out

Dan Alexander1
Mega Expert

Hi Folks,

 

We are trying to capture the time when a ticket is 'New' or 'Unassigned' with a group, until the assigned_to field is not empty. Played around with a few variations of some current metrics in place without much luck, any ideas?

 

Thanks!

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Dan,



Please go through the below wiki link for more info.


http://wiki.servicenow.com/index.php?title=Setting_the_Duration_Field_Value


Harish Murikina
Tera Guru

Hi Dan,



                          Create a metric with type "Script Calculation" and write the below code it will calculate duration between ticket creation and assigned_to.



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();


}



Regards,


Harish.


Thanks Harish -- this doesn't seem to capture ticket re-assignment to another group. For example if a Ticket is assigned from One group to another -- we want to capture how long it sits there before that new group assigns it to a person.


Hi Dan,



                        The above script calculate only once . If you wants to calculate ticket assigned to one person to another person you have to go type field value duration.



Field value duration only will get calculate ticket assigned from one user to another. But it wont calculate assigned_to is from empty to assigned some one.



Regards,


Harish.