- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2016 06:24 AM
Hi All,
I'm trying to capture the first time an incident is assigned to each assignment group.
For example:
Assignment Group Metric
Service Desk Capture
Incident Management Capture
Networks Capture
Incident Management Don't capture
Databases Capture
Networks. Don't capture
I know that metrics will capture each assignment, but I just need the first. I assume I need some sort of scripted metric?
Thanks!
Mithun
Solved! Go to Solution.
- Labels:
-
Performance Analytics
-
Reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2016 10:45 PM
Mithun,
Out of the box, there is a Metric Definition "Assignment Group" that does almost what you want, but does a bit more than what you want. The out of the box Metric would create a new Metric Instance record each time the assignment group changes, and calculates the duration for which the task record stayed with that assignment group. So if the task record were to be assigned back to the same assignment group again, you will see two Metric Instance records. But nevertheless, you will still be able to sort the records to figure out the first time the task was assigned to that group.
The Metric Instance records would look like below, when the Task assignment changes in the sequence of: CAB Approval, Database, Network, Database, Hardware.
If you want you can always create a script based Metric Definition, that does exactly what you are looking for. The script would look like:
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
// Initialize the MetricInstance
var mi = new MetricInstance(definition, current);
// Check if a metric already exists for the current task for assignment group
if (!metricExists()) {
var gr = mi.getNewRecord();
gr.field_value = current.getValue(definition.field);
gr.start = current.sys_updated_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
function metricExists() {
var gr = new GlideRecord('metric_instance');
gr.addQuery("id", current.sys_id);
gr.addQuery("definition", definition.sys_id);
gr.addQuery("field_value", current.getValue(definition.field));
gr.query();
return gr.hasNext();
}
I am attaching the XML file for the sample Metric Definition, that you can import into your instance and test easily.
The Metric Instance records would look like below, when the Task assignment changes in the sequence of: CAB Approval, Database, Network, Database, Hardware.
You can see that in this case, there is only one record or Database group, even though task was assigned to Database, multiple times.
Hope this helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2016 10:45 PM
Mithun,
Out of the box, there is a Metric Definition "Assignment Group" that does almost what you want, but does a bit more than what you want. The out of the box Metric would create a new Metric Instance record each time the assignment group changes, and calculates the duration for which the task record stayed with that assignment group. So if the task record were to be assigned back to the same assignment group again, you will see two Metric Instance records. But nevertheless, you will still be able to sort the records to figure out the first time the task was assigned to that group.
The Metric Instance records would look like below, when the Task assignment changes in the sequence of: CAB Approval, Database, Network, Database, Hardware.
If you want you can always create a script based Metric Definition, that does exactly what you are looking for. The script would look like:
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
// Initialize the MetricInstance
var mi = new MetricInstance(definition, current);
// Check if a metric already exists for the current task for assignment group
if (!metricExists()) {
var gr = mi.getNewRecord();
gr.field_value = current.getValue(definition.field);
gr.start = current.sys_updated_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
function metricExists() {
var gr = new GlideRecord('metric_instance');
gr.addQuery("id", current.sys_id);
gr.addQuery("definition", definition.sys_id);
gr.addQuery("field_value", current.getValue(definition.field));
gr.query();
return gr.hasNext();
}
I am attaching the XML file for the sample Metric Definition, that you can import into your instance and test easily.
The Metric Instance records would look like below, when the Task assignment changes in the sequence of: CAB Approval, Database, Network, Database, Hardware.
You can see that in this case, there is only one record or Database group, even though task was assigned to Database, multiple times.
Hope this helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2016 06:18 AM
Hi Aditya,
Yes, that's perfect! Thanks very much.
Thanks
Mithun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 12:06 PM
Hi, thanks for this. Please could you detail how this could be modified to capture only the very first/initial assignment of the incident (i.e. the Assignment group value at very first assignment)?
I see the general 'Assignment group' metric definition you refer to but as you say this picks up every assignment. Thank-you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2020 01:51 AM
Hi DJS43,
Did you got any resolution for this? Even i have a similar requirement.
Thanks,
PY