Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Reporting on Average Age of Incidents & other Task Types

Declan Miller1
Kilo Explorer

Hello,

I am very new to Performance Analytics and have been using a few OOTB packs that come with the tool to tailor my reporting to the teams I support.
I have encountered an Issue whereby I am unable to get the Average Age of Open Incidents.

My current method is to have 3 Indicators setup and use a formula to calculate the average.

1: Sum of Open Incidents

Source: Incidents assigned to xyz Assignment Groups
Aggregate: Sum
Field: Active
Additional conditions: State not in (Resolved, Closed)
Table: Incident

2: Summed age of Open Incidents

Source: Incidents assigned to xyz Assignment Groups
Aggregate: Sum
Script: var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.opened_at, score_end);
Additional conditions: Active = true .and. State not in (Resolved, Closed)
Table: Incident

3) Average Age of Open Incidents

Formula: [[Summed age of Open Incidents]]/[[Sum of Open Incidents]]/24

All of these indicators are linked to a historic job I ran which came up with the error:
Error during JavaScript evaluation: Not all references of "current" are passed in by "arguments" script: var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.opened_at, score_end);

When I check the Widget, no data is displayed. I took the script from the OOTB "HRCase.Open.Age.Hours" which I assumed could be copied to anywhere and yield the same results. However, evidently this is not the case. I was hoping for some guidance on where I may be going wrong. I also have little to no experience with JavaScript so not really able to translate the error.

1 REPLY 1

Harneet Sital
Mega Sage
Mega Sage

Hi Declan, 

Have you already looked at these OOTB PA widgets? Do these fulfill the requirements you are looking for? 

https://YOURINSTANCE.service-now.com/pa_widgets_list.do?sysparm_query=nameLIKEIncidents%5EnameLIKEAv...

I can see there is one existing OOTB indicator you can use as a replacement for your second indicator - Summed age of open incidents screenshots below -

(Link - https://InstanceName.service-now.com/pa_indicators.do?sys_id=fd5a3e02d7130100b96d45a3ce6103aa)

find_real_file.png

 

find_real_file.png

Let me know if the above does not help, we can check further. 

 


Thanks
-Harneet Sital (ServiceNow Certified Technical Architect)
Request you to please mark my answer as helpful or correct based on the impact

Find all my ServiceNow articles here