We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Metrics with script calculation.

shalinikacham
Kilo Expert

Hi all,

I'm trying to create metrics to calculate 'Time between ticket creation and ticket closure' for a particular assignment group.

I've written the following code so far but the script doesn't work at all whatever the condition is.

find_real_file.png

From Subject Received Size Categories Andy Parimi FW: ServiceNow Metric Data 8:40 AM 40 KB

10 REPLIES 10

shalinikacham
Kilo Expert

This is what i get:



find_real_file.png


Chuck Tomasi
Tera Patron

The assignment group is going to contain a sys_id. If you want to check against the name, use something like this:



var group = current.assignment_group.getDisplayValue();


Thanks Chuck. I'm new to metric definition. I have modified code as you mentioned but it did not work yet.



Do i have to trigger the metric I defined? All i did was to create a metric definition using script calculation.


Yes, you need to trigger what ever condition defined by the metric. They don't run automatically. They are evaluated when the record is updated.