Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

want to update the incident number field color based on the sla percentage

Shrinidhi Amin
Tera Contributor

implement the color code (green / yellow / red) in the ticket number field itself at top the page based on SLA percentage

2 REPLIES 2

Sonu Parab
Mega Sage

Hi @Shrinidhi Amin
1] Create one onLoad client script on task_sla  table. (You can take table accordingly).
2] Use below Script to set color of ticket number field.

 

function onLoad() {
    //Type appropriate comment here, and begin script below

    var percentage = g_form.getValue('business_percentage');   // use your field which store SLA percentage 
    //alert(percentage);

    if (percentage >= 0 && percentage <= 25) {
        g_form.getDisplayBox('task').style.backgroundColor = 'green';   // take 'ticket number' field insted of 'task'
    } else if (percentage >= 26 && percentage <= 50) {
        g_form.getDisplayBox('task').style.backgroundColor = 'yellow';
    } else if (percentage >= 51 && percentage <= 100) {
        g_form.getDisplayBox('task').style.backgroundColor = 'red';
    }



}

 


Please mark as correct answer if this solves your issue.
Thank you
 

Ankur Bawiskar
Tera Patron
Tera Patron

@Shrinidhi Amin 

can you share exactly where is this required? share screenshot

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