Metrics and business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2019 12:59 AM
Hi,
We have a requirement to calculate business duration and duration fields on SC task and RITM as the difference of total duration and on-hold duration (custom fields). We had created a metric for calculating the on-hold duration, and then used the OOB "close ticket" business rule on SC task table to fetch the required result. This is populating the values of business duration and duration in some cases and not in few cases:
1. When SC task changes from any state to "on hold" and then back to any of open, and then it is closed -->> the duration and business duration are calculated and displayed properly.
2. When SC task is closed directly from on-hold state, then the duration fields are calculated without taking into account the "on-hold duration".
Can someone help me with the order of execution of these business rules and metric calculation? I believe it is causing the issue.
Thanks in advance,
Anu
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2019 01:12 AM
Difficult to point to the issue without exploring all your config, an easy solution would be to prevent people from closing the ticket while it's in the on hold state.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2019 02:21 AM
Hi Anusarma,
I think the business rule condition causing the issue.
condition should be 'previous.state ==on hold && (current.state == open || current.state == closed)'.
//we have to save the metric def in sys_property (incident_assigned_by_queue_manager) and using the below script
var metricSysId = gs.getProperty('incident_assigned_by_queue_manager');
var metric_definition_details = new GlideRecord('metric_definition');
metric_definition_details.get(metricSysId);
var mi = new MetricInstance(metric_definition_details, current);
var gr = mi.getNewRecord();
gr.value = current.state.getDisplayValue();
gr.start = current.sys_updated_on;
gr.insert()
Update your business rule script like above.
Regards,
Kotaiah Sadari