How to write a script to show tickets created with a 5min delay or more from impaired time

Jeannie Taylor
Tera Contributor

Hello,

 

I'm trying to create a report or a widget (whichever will help me illustrate best) tickets which are created with more than 5 mins delay from the actual impaired time.

 

I'm assuming the best way to achieve this will be in PA with a script, and have never written a script yet.  

 

Is anyone able to please help me?

 

Thanks!

8 REPLIES 8

Arav
Tera Guru
Tera Guru

Hi,

How do you determine if a ticket was created with a delay? Do you have another table in ServiceNow that indicates the actual start time of the issue ?

Thanks,

Arav

Hi There,

 

We have 'service impaired time,' and 'created' and 'opened.'  'created' and 'opened' are essentially the same.

 

Thanks!

Hi @Jeannie Taylor ,

You may consider using Metrics for this purpose as both fields are on the same table.

Please check existing Metric definitions that are of type "Script calculation" (please see below URL for reference).

https://<your instance>/metric_definition_list.do?sysparm_query=type%3Dcalculation&sysparm_view=

The "Create to Resolve Duration" metric definition demonstrates how two date fields are used to compute the duration. Once setup, the answers will be stored in "metric_instance" table but you can report them from Incident metrics (a database view on incident, metric definition, and metric instance).

P.S - There is a difference between "created" and "opened" times. If you open an incident form at 10 AM but actually create it after filling in relevant information at 10:20, then opened will show 10 and created 10:20.

Thanks,

Arav

Hi Arav,

 

Thank you for clarifying the opened vs create field purposes!

 

I'm not looking for duration, I'm only looking to present INC tickets which have a delayed create time of 5 minutes from 'impaired time.'  We are trying to find any anomalies in our ticketing system.  

 

Will the above URL assist with that?

 

Thanks!