logo

NJP

Change Color for State. if Priority is Critical then state is Red , Priority is High then Change state to Orange, Priority is Moderate then Change state to Green

Import · Jun 10, 2022 · article

function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; }var Priority = g_form.getValue('priority');if(Priority=='3') { g_form.getElement('state').setStyle({color:"green"}); } else if(Priority=='2') { g_form.getElement('state').setStyle({color:"orange"}); } else if(Priority=='1') { g_form.getElement('state').setStyle({color:"red"}); }

}

View original source

https://www.servicenow.com/community/itsm-articles/change-color-for-state-if-priority-is-critical-then-state-is-red/ta-p/2304704