We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How can we set incident number in to orange color when SLA breached to 90%

Not applicable

We need to set incident number field orange color when SLA breached to 90% 
Please help me how to achieve this.

1 ACCEPTED SOLUTION

Karan Chhabra6
Mega Sage

Hi @Community Alums ,

 

To achieve this you need to create a record in the style(sys_ui_style) table and a script include to get the value of sla percent.

 

Step 1: Navigate to sys_ui_style.list and create a new record

value: 

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

KaranChhabra6_1-1686135575312.png

 

Step 2: Create a script include named 'ElapsedSLA', please use this script

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

    getSLAPercent: function(incRef) {
        var slaPercent = '';
		var sysID = incRef.sys_id;
        var slaGR = new GlideRecord('task_sla');
        slaGR.addQuery('task', sysID);
        slaGR.query();
        if (slaGR.next()) {
            slaPercent = slaGR.business_percentage;
        }

        return slaPercent;
    },

    type: 'ElapsedSLA'
};

 

KaranChhabra6_2-1686135666444.png

 

Output: 

KaranChhabra6_3-1686135712084.png

 

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

 

Thanks!

View solution in original post

3 REPLIES 3

Karan Chhabra6
Mega Sage

Hi @Community Alums ,

 

To achieve this you need to create a record in the style(sys_ui_style) table and a script include to get the value of sla percent.

 

Step 1: Navigate to sys_ui_style.list and create a new record

value: 

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

KaranChhabra6_1-1686135575312.png

 

Step 2: Create a script include named 'ElapsedSLA', please use this script

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

    getSLAPercent: function(incRef) {
        var slaPercent = '';
		var sysID = incRef.sys_id;
        var slaGR = new GlideRecord('task_sla');
        slaGR.addQuery('task', sysID);
        slaGR.query();
        if (slaGR.next()) {
            slaPercent = slaGR.business_percentage;
        }

        return slaPercent;
    },

    type: 'ElapsedSLA'
};

 

KaranChhabra6_2-1686135666444.png

 

Output: 

KaranChhabra6_3-1686135712084.png

 

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

 

Thanks!

Not applicable

Hi @Karan Chhabra6 ,

Hi @Abhijit4 ,

Hi @Ankur Bawiskar 

I have tried as you mention above,but incident number background color is displaying, its just displaying dot color as shown below screenshot, i want to display incident number exactly same like you display.

anitha0887_0-1747927999514.png

 

@Community Alums 

Please raise a new question and tag me there as this is an old thread.

Share all the details.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader