- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 02:58 AM
We need to set incident number field orange color when SLA breached to 90%
Please help me how to achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 04:04 AM
Hi @Arun61 ,
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;
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'
};
Output:
If my answer has helped with your question , please mark it as correct and helpful
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 04:04 AM
Hi @Arun61 ,
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;
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'
};
Output:
If my answer has helped with your question , please mark it as correct and helpful
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 08:33 AM - edited 05-22-2025 09:29 AM
Hi @Karan Chhabra6 ,
Hi @Abhijit4 ,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 10:01 AM
Please raise a new question and tag me there as this is an old thread.
Share all the details.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader