Metrics with script calculation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2016 08:54 AM
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.
From Subject Received Size Categories Andy Parimi FW: ServiceNow Metric Data 8:40 AM 40 KB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2016 08:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2016 08:57 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2016 09:05 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2016 09:06 AM
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.