Report help - created to first updated metric

Travers M
Mega Guru

This one might be easy and I'm just missing it but I'm looking to create a report for incidents that shows a report that shows the time elapsed from when a ticket was created to when it was first addressed/updated.   I know the numbers may be a bit misleading as we aren't a 24/7 shop and the times would be ticking during off hours so if anyone would know a magic trick to keep that out I'd be most grateful.  

1 ACCEPTED SOLUTION

Hopefully this helps you out, I got the same message that you did when I clicked the original links.  



I created a new metric definition.   On the incident table and the incident state field and the type was script calculation with the following script;



// variables available


// current: GlideRecord -   target incident


// definition: GlideRecord -   (this row)


if (current.sys_mod_count == 1)


  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, gr.end);


  gr.calculation_complete = true;


  gr.insert();


}



I'm looking for the report I was running that pulled the the average time to address but just can't find it.   I really dislike the layout for the reports in Fuji but that's another gripe for another time.     Let me know if this is what you needed and I'll keep looking for that report if you'd like to see it.


View solution in original post

8 REPLIES 8

ghaing
Giga Expert

Hi,


Try using "Business duration" field in Metric instance.


And this to calculate durantion based on schedule :


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



Regards,


Thank you for the reply.



Business duration is open to close.   I need open to first updated and just can't find that information or the way to pin that down


Travers M
Mega Guru

I did find an answer in another thread that satisfied this requirement.   I had to create a new metric in the system that captured it.   It was posted by Michael Fry in this thread First Response Time



Granted it only captures on new incidents, but now I can report on this moving forward.


Hi - can you tell me where to find this information - I have followed the link and get an unauthorized message.



I need to report on first updated in incident