Create metric definition to calculate total time taken excluding on hold duration

Anushiya Preeth
Tera Contributor

Hi All,

 

Requirement is to create a metric definition to calculate the total time taken from open to resolve state excluding on hold duration. The on-hold duration is to be considered only when certain 'on hold reasons' are selected where of some them pause the sla and the others don't (I have created a custom metric definition to track on hold duration only for specific on hold reasons). I tried to create the metric definition using task_sla table by adding a query on pause stage but it doesn't seem to work, as the on hold reasons we are looking for doesn't necessarily pause the SLA. Can someone please help me with the code that can fulfil my requirement. Thank you!

8 REPLIES 8

Mark Manders
Mega Patron

If it is that important to know (someone asked for this for some reason), why not just create an SLA definition to track this? Exclude it from 'normal' SLA reporting so it doesn't show up there, but you will have the correct value you are looking for and the system is calculating it.

That would be a much easier way than to create a very complex metric. Metrics are very powerful, especially if it is just from point a to point b (and with script you can do even more), but you will need to check on too many things to make it really reliable. 

 

SLA definitions are created for calculating exactly this (just not for reporting purposes, but that doesn't mean you can't use it for that). 
In fact, at one of our clients we had lots of reporting requirements that could either be done in a very difficult way, or use the SLA engine. We created an extra 'target' choice (next to 'Response' and 'Resolution' we added 'Reporting') and to not make it too difficult to understand for the agents, we excluded the 'reporting' SLA definitions from the related lists on the tickets. 

Because your 'pause' is on reasons that are not always pausing the 'real' SLA, I think moving your solution from metrics to SLA definitions will get you there easier and faster. 

Another way to do this (just depending on the reason behind the requirement), is to put the field on the table itself. And then, from the changes on the form, have a flow calculate the field. That would take some logic to store all necessary data for the calculation, but that could be done as well. 


Personally, I would just go with the SLA definition. It's already there, you just have to set it up (start = on creation, pause = your on hold reasons, stop is resolve/close).


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Thank you for replying @Mark Manders . Just wanted to give a background on the requirement, initially the ask was to create a custom field on incident form to display the adjusted duration (total - on hold), however we decided to create a metric definition instead so this can be made reportable for the users, also because we try to minimize custom field creation wherever possible. While SLA definition is a better option, I thought metric definition would work for this requirement. That being said, if metric definition option doesn't work as expected, will probably go with SLA definition.  Thank you!

I think it is possible to do it through metrics but that would mean thinking up a lot of logic, scripting it and validating. In the future maybe something changes (an extra on hold reason to add/remove) and you need to get back into that script (or worse, someone else needs to). And the SLA Definition will give you the same result with just a few clicks. It will save you a lot of time now and in the future and it gets you the same result.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Thank you for the input @Mark Manders. This is very helpful, much appreciated!