- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 09:02 AM
I have a client who is requesting a report/list of incidents whose priority has changed. I'm able to come up with a metric definition that looks at the priority field and it works fine (I'm using the type Field Value Duration). The problem that I'm having is the client wants to skip the initial priority and just list if the initial priority changes. For example, if the incident is opened as a priority 3, gets reassigned twice and then gets changed to a priority 2, only show the change from P3 to P2. Right now the way the metric definition works, it captures when the ticket is opened and assigned the original P3 priority. I'm sure there is a way to do this I just have no clue how. Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 11:15 AM
Sorry Keith my bad, read as you had it as a script metric :$ - hence "// Create metric instance" comment (was expecting you to copy and paste into there)
So redone for you below, complete with script code.
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
if (current.sys_mod_count > 0) {
var mi = new MetricInstance(definition, current);
var gr = mi.getNewRecord();
gr.field_value = current.priority;
gr.field = null;
gr.calculation_complete = true;
gr.insert();
}
Definition picture:
Had to do away with isNewRecord(), didn't work - used sys_mod_count instead.
Thanks
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2016 10:11 AM
Hi Keith
Glad that worked.
I've come across the same issue many times. Unfortunately it isn't as simple as a solution than a metric now. In these cases I create a new table to hold this information in. Each time the priority changes you can create a new record in your custom table with the time and who did it (can use standard sys_created_on and sys_created_by fields), just do that in an on after business rule. This table can then be reported on - don't forget to include a reference to the incident that created it!
Thanks
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2016 05:33 PM
Just a quick one guys - is this not possible through the standard reporting engine in ServiceNow using the incident_metric table?
Cheers,
Dan