Duration field on RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2016 10:57 PM
Hi All,
I need duration of RITM by OOB, When i resolve incident , I am getting duration field auto populated but for RITM when I close complete, duration field is not auto populated. Is there any way to achieve this by OOB without any customizations. Please find screenshots below,
Incident:
RITM:
Thanks in Advance
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2016 11:39 PM
Hi Jeevitha,
In incident this field is populated from OOB BR mark_resolved.
Create a new BR in requested item table and copy the piece of code from OOB BR.
Thanks,
Maddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2016 11:49 PM
Hi
The duration field (calendar_duration) is set by a business rule called "mark_resolved". There are one defined for both incident and problem.
You need to make a copy if one if these an implemented it for the sc_req_item table.
Alternatively you can create a metric to calculate the duration and get the result from the metric table instead
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
var s = current.state;
if (s == 3 || s == 4 || s == 7)
createMetric();
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}