Solution: presenting color-coded elapsed SLA resolution time in the incident lists
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2015 07:37 AM
Hey SNC,
I know there are a bunch of open articles about the topic in the community, so I decided to put up an article with my solution of this.
The case was: we needed to present the Resolution SLA elapsed percentage (time between start and end, minus the paused time) in the Incident list views, and color code the incidents based on the elapsed time. (NOTE: in the case where we have more than just one SLA task attached to a record, because I know the use-case of just one can be done simpler)
So, here goes:
1. new read-only field on the incident table called 'Resolution SLA %', does not need to be on the form
2. new before business rule on the task_sla table with the condition of: 'actual elapsed percentage changes' && 'SLA contains resolution'; the script looks up the related incident and updates the 'Resolution SLA %' field as per the change in the 'Actual Elapsed Percentage' field:
function onBefore(current, previous) {
if (current.task.sys_class_name == 'incident') {
var gr = new GlideRecord('incident');
if (gr.get(current.task.sys_id)) {
gr.u_resolution_sla = current.percentage;
gr.update();
}
}
}
3. new field background-color styles on the 'Number' field in Incident form, which colors the incidents which are within a specified percentage range and in the states you want (I wanted only the ones In Progress and Open to be colored). The value of the field style goes like this (1 and 2 are the states which I want to color)
javascript: (current.u_resolution_sla >= 75 && current.u_resolution_sla < 100) && (current.state == '1' || current.state == '2');
4.new field color styles on the 'Resolution SLA %' field in Incident form, which colors the percentage displayed when in the specified range of percentage. Value looks like that:
javascript:current.u_resolution_sla >= 1 && current.u_resolution.sla < 75;
5. SLA actual elapsed time is by default calculated by a scheduled job and will run at 50%, 75% and 100%. However, if you want the actual elapsed percentage to be updated on every task_sla form load, then you can turn on a system property called 'glide.sla.calculate_on_display'; It could cause performance issues as it loads on the client side, but only in the cases where you have multiple SLAs attached, and you can always turn it back off if so. Or you could change the default workflow 'Standard SLA' and set up more trigger points than just 50/75/100. More useful info on this here: Configuring SLA Calculations with the glide.sla.calculate_on_display property
So here is how the outcome looks like - it applies the traffic lights to your incident list view based on the elapsed resolution SLA percentage. Beautiful:)
- 12,183 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2017 07:20 AM
Hi Dimitar,
Found your article whilst searching for tips to achieve the same outcome.
I've done as you've described but my Resolution SLA % field doesn't seem to populate, I'm putting this down to an issue with my Business Rule. The field on my form (displayed for testing purposes) remains blank.
I'm using version Istanbul.
Any guidance would be much appreciated.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2017 06:21 AM
Same here.
The field is not being populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2017 06:23 AM
Hi,
The Resolution SLA % field is not being populated. Any suggestions?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2017 06:28 AM
hugogomes - can you give me a screenshot of your condition in the business rule. And a screenshot of your SLA definition.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2017 06:56 AM