How to calculate SLA pause duration time for each choice value of field

lucky24
Tera Contributor

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.

 

find_real_file.png

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?

 

10 REPLIES 10

BTW, it might actually be easier to just apply that metric to your security incident table. If the logic is that SLA is always paused whenever one of those states is selected, the metric can basically just capture those states' durations. The durations should then be equal to the SLA pause resulting from those states.

One more thought heh. Havent worked with metrics in a while, but there might be a limitation that they only get triggered based on a single field. If that is the case, I remember just using a custom Business Rule to insert/update those metric records. So basically we are moving in the direction of fully custom logic calculating those metrics and just storing them in the OOTB table.

Hi Tomasz,

I have crated metrics definition for calculate the time.

find_real_file.png

but the problem is when I am changing value Awaiting caller second time it is creating new record in metrics definition.

 

find_real_file.png

Is it possible to update in same record when we change value second time .

And can we not achieve it by business rule?

You can do it, you have to create 3 fields for  each choice value, start time, end time and duration which stores the difference between the start time and end. Whenver that choice is selected set the start time and whenver the choice value changes from what it was then set the end time and calculate the duration for that choice value. Do this for all the choice values 

Yeah this is the standard behaviour. To have the extra time added to the previous entry, you need to use "Scripted" type and then add a script to check for existing instance record and add the time value to existing one.

Within a BR you could also achieve this, with a condition being that the value "changes to" your choices or value "changes from" your choices (it can get a bit tricky though to get all possible trigger combinations). Then that BR can also insert or update a metric instance record. In any case, the time calculation and updating of existing value needs to be scripted.