Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Unable to execute a custom Metric definition to calculate elapsed time until the first assignee

AndreTella
Tera Contributor

Hi everyone,

I'm trying to build a custom metric in ServiceNow to measure the following KPI:

Average time from Incident creation until the Incident is assigned to an analyst (Assigned To field).

Specifically, I want to calculate how long an Incident remains with Assigned To = Empty from the time it is created until the first time it is assigned to a user.

I created a Metric Definition with:

  • Table: Incident
  • Type: Script Calculation
  • Active: True

And I'm using a script (attached)

AndreTella_0-1791399796080.png

 

Issue

The metric is not being captured and no records are being created in the metric_instance table.

 

Questions

  1. Has anyone successfully implemented a metric that measures the time until the first population of the Assigned To field?
  2. Is a Script Calculation metric the correct approach for this requirement, or should I be using a Duration metric instead?
  3. Is there a better OOTB method to report on "time from creation to first assignment"?
  4. Are there any special considerations with MetricInstance, metricExists(), or changesToNotNil() when used in Metric Definitions?

Any examples or working configurations would be greatly appreciated.

Thanks!

 
0 REPLIES 0