How to calculate SLA pause duration time for each choice value of field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 11:31 PM
Hi Team,
on the form there is field on hold reason with 3 choice value.
1)Awaiting caller
2)Awaiting info
3)Awaiting problem
When user will select any value in one of these and SLA will be pause. SO we have to calculate SLA pause duration for each value and have to populate value in below field.
for example how much time SLA was paused for Awaiting caller, awaiting info, Awaiting problem.
I am stuck here please help me here how can we achieve it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2022 09:19 PM
Hi,
I am trying to sum all metrics instance duration through Business rule so I think we can get our result.
I am not sure, Is it possible to get result by this can I know your opinion?
For that I am using business rule to sum duration of metrics record but i am failed with script.
I am Trying with below code
var duration = new GlideDuration(0);
var mi = new GlideRecord("metric_instance");
mi.addQuery("id", current.sys_id);
mi.addQuery("definition", "fc47ec1d2f1341105d0d56e62799b64e");
mi.addQuery("value", "Awaiting Caller");
mi.query();
mi.getRowCount();
// while(mi.next()){
var dur = new GlideDuration();
dur.setValue(mi.getValue('duration'));
duration = duration.add(dur);
// }
current.u_pause_duration= duration.getDisplayValue();
current.u_total_hour=duration;
gs.addInfoMessage(duration.getDisplayValue());
gs.addInfoMessage(mi.getRowCount());
current.update();
Can you help me here with script?