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

Mridul Srivast1
Tera Explorer

Client Script

How to Change the Background Color for Priority in Incident :- 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}

//Type appropriate comment here, and begin script below


if(newValue == 1) {
var element = g_form.getElement('priority');
element.style.backgroundColor = "red";
} else if(newValue == 2) {
var element1 = g_form.getElement('priority');
element1.style.backgroundColor = "orange";
} else if(newValue == 3) {
var element3 = g_form.getElement('priority');
element3.style.backgroundColor = "green";
} else {
var element4 = g_form.getElement('priority');
element4.style.backgroundColor = "black";
}

}

 

Version history
Last update:
‎06-10-2022 03:01 AM
Updated by: