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

@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!