how to highlight incident in red when SLA breached to 100 %

shweta14
Tera Contributor

I have a requirement when SLA breached to 100% then incident should highlighted in Red color.

 

referred this link but not helpful : - https://www.servicenow.com/community/developer-forum/how-can-we-set-incident-number-in-to-orange-col...

how to achieve this?

 

 

Thank you in advance!

1 ACCEPTED SOLUTION

@shweta14  Thanks - you need to make changes to your script include, since you have multiple SLA's attached and the incident should be highlighted even if one SLA exceeds the threshold.

 

Update the value in the style record to:

javascript: new ElapsedSLA().getSLAPercent(current) == true;

 

Update the script include

var EscalateSLA = Class.create();
EscalateSLA.prototype = {
    initialize: function() {},

    getSLAPercent: function(incRef) {
        var flag = false;
        var slaPercent = '';
        var sysID = incRef.sys_id;
        var slaGR = new GlideRecord('task_sla');
        slaGR.addQuery('task', sysID);
        slaGR.query();
        while (slaGR.next()) {
            if(slaGR.business_percentage >=90){
                  flag = true;
                  return flag;
                 }
        }
        return flag;
    },

    type: 'EscalateSLA'
};

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!

View solution in original post

10 REPLIES 10

Please use

javascript: new EscalateSLA().getSLAPercent(current) >= 90;

Hi Jaspal,

tried but not working both conditions are same

Karan Chhabra6
Mega Sage
Mega Sage

Hi @shweta14 ,

 

Do you have multiple SLA's attached to the incident record for which you're testing this, if yes - could you please share a screenshot of that?

 

Thanks!

Hi Karan,

There is no specific one i'm checking.Based on 100% breach checking the incident.

for example checking for this

shweta14_0-1686648283863.png