Metric definition to calculate time difference between two state

somujit
Tera Contributor

Hello Experts,

I have a requirement to calculate the time difference from 'on hold' to 'in progress' for incident records.

I am aware of the duration calculation option in metric definitions, however it just shows the time duration for individual state.

Is there a way to use the metric definitions scripting to calculate and capture the time difference between 'on hold' to 'in progress'?

Any suggestions would be much appreciated!!

Thanks in advance.

8 REPLIES 8

I just wanted to check-in on this and see how things were going for you.

If my reply above helped answer or guide you correctly, please mark it as Helpful & Correct.

 

Thanks!

I just wanted to check-in on this and see how things were going for you.

If my reply above helped answer or guide you correctly, please mark it as Helpful & Correct.

 

Thanks!

I would only create those extra fields if you plan to use those fields in your lists, conditions or filters. 

D van Heusden
ServiceNow Employee
ServiceNow Employee

For this use case I would either use a (scripted) metric or an SLA Metric if you need to exclude states or have specified work hours that need to be taken into account.

See below for an example scripted metric that comes out of the box:

find_real_file.png

In the above case the metric is created when a certain state is reached and then calculated from open. You could change that to create a metric from the beginning state and than add the logic to update/complete it when it reaches the end state.

-David