Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Completing Metric Instance calculation when ticket is closed

kssnyder
Kilo Explorer

I am using a few OOB Metrics in reports to identify duration of how long a incident ticket was assigned to a person or group, but if the ticket is closed, the last metric is not updated so that calculation is never completed. The base Metric article (http://wiki.service-now.com/index.php?title=Metric_Definition_Support) states that a script can be used to complete a metric instance when a ticket is closed, but I have not been sucessful in actually building one.

A co-worker suggested adding the following into the script section, but this did NOT stop the metric when the incident was closed:

if (!current.active) {
answer = false;
}

Any suggestions as to what the script should be are most appreciated.

The fact that the last metric is not automatically completed when a ticket is closed was alluded to in Reporting on the date/time a task was assigned to a person, but since I'm actually looking for the script I made a new post.

6 REPLIES 6

bhaskarpinnadha
Kilo Contributor

Hey KSSnyder,



Did you find a way in calculating the closed state in a metric through any script? I am currently facing the same challenge.Would be great if you can share your insights if you found the solution.



Regards


Bhaskar Chaitanya P


There is a Metric on the Incident table named Open. Review that Metric and you should have your answer on what to do.