Incident Metric table - reporting off Value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 07:42 AM
I've rediscovered the Incident Metric table and have been trying to do some reporting out of it. The issue I can see with SNOOB (ServiceNow Out of Box) is that the 'Value' field is just a String, which means there's no way to dot-walk it. That limits report possibilities considerably.
Am I missing something, or is this a problem others have had and have come up with some solution? Right now in my Developer instance I added Reference fields for User and Group that get auto-populated when appropriate, so I can report through those. I'm not sure that is the best solution however.
Thoughts?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 09:12 AM
Exactly what I saw and actions I took - added reference fields and populate those in the Metric. Did see any other options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 09:37 AM
Well since great minds think alike - did you do anything to try to sum up durations? Like if a single Assignment Group was sent the same Incident multiple times, finding their total duration for that Incident? I'm having a heck of a time trying to get that to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 11:48 AM
Well after a few hours of beating on it, this BR on the Incident Metric table seems to work:
(function executeRule(current, previous /*null when async*/) {
var tvdsum = 0;
var gr = new GlideRecord('metric_instance');
gr.addQuery('id', '=', current.id);
gr.addQuery('definition', '=', current.definition);
gr.addQuery('value', '=', current.value);
gr.orderByDesc('sys_created_on');
gr.query();
while (gr.next()){
// gs.addInfoMessage(gr.sys_created_on);
// gs.addInfoMessage(gr.duration.dateNumericValue());
tvdsum += gr.duration.dateNumericValue();
gr.u_total_value_duration = '';
gr.update();
}
current.u_total_value_duration.setDateNumericValue(current.duration.dateNumericValue() + tvdsum);
})(current, previous);
EDIT: Updated the formula to one that works. 😉

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 11:53 AM
Nice! Hadn't done anything like that, but that's helpful.