- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2011 03:28 AM
Hi all,
It appears that none of the metrics display the business duration.
To report of the amount of time a particular task was assigned to each support groups using the business hour i.e. incorporate the default schedule/calendar
Currently the 'Assignment Group' metric does perform this action, however, the duration calculated does not take into account the business hours.
There is a field on the metrics table called 'business hours' but it is always blank.
Any ideas?
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2011 02:38 PM
sncuser
The official response from support is that the issue reported above is a bug. They have logged a problem for it to be fixed in the subsequent releases.
The workaround for the specific issue above is to add a line of code in the Metrics Script Include as follows:
Navigate to Script Includes
Find the Record named "MetricInstance"
Find the function "endDuration", modify it to the following: (added line commented below)
endDuration: function() {
var gr = new GlideRecord('metric_instance');
gr.addQuery('definition', this.definition.sys_id);
gr.addQuery('id', this.current.sys_id);
gr.addQuery('calculation_complete', false);
gr.query();
if (!gr.next())
return;
gr.end = this.current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.business_duration = gs.calDateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue()); // This is the added line!
gr.calculation_complete = true;
gr.update();
}
Also to note: You may or may not be aware that 'gs.calDateDiff' uses the first Calendar in the system. Calendars are legacy and have been replaced by Schedules. So to modify the above to use schedules look at the wiki article below:
http://wiki.service-now.com/index.php?title=Calculate_Duration_Given_a_Schedule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2011 02:38 PM
sncuser
The official response from support is that the issue reported above is a bug. They have logged a problem for it to be fixed in the subsequent releases.
The workaround for the specific issue above is to add a line of code in the Metrics Script Include as follows:
Navigate to Script Includes
Find the Record named "MetricInstance"
Find the function "endDuration", modify it to the following: (added line commented below)
endDuration: function() {
var gr = new GlideRecord('metric_instance');
gr.addQuery('definition', this.definition.sys_id);
gr.addQuery('id', this.current.sys_id);
gr.addQuery('calculation_complete', false);
gr.query();
if (!gr.next())
return;
gr.end = this.current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.business_duration = gs.calDateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue()); // This is the added line!
gr.calculation_complete = true;
gr.update();
}
Also to note: You may or may not be aware that 'gs.calDateDiff' uses the first Calendar in the system. Calendars are legacy and have been replaced by Schedules. So to modify the above to use schedules look at the wiki article below:
http://wiki.service-now.com/index.php?title=Calculate_Duration_Given_a_Schedule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2013 01:33 PM
Is this working now? It doesn't seem like it is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2013 01:42 AM
chaslage
Just checked with our Dev team. Looks like the solution is still in the backlog.
Meanwhile, please use the workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2013 04:33 AM
Since my comment I decided to do a few changes of my own:
- Add a field to the Metrics Definition form that says Schedule
- Added a check on that workaround script to look at that attached schedule (instead of using a static schedule)
Plus, I have Business Definitions running against the Metric Instances. So yeah, no worries mate. 😄