How can I set the incident number text color to red when it is a P1 incident?

jesusnava
Giga Expert

Hello everyone, 

I would like to change the number of the text color to red when it is a P1 incident, I have this script but seems not to be working:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (priority == '1') {
NumberField.setStyle({color: "red"});
}
//Type appropriate comment here, and begin script below

}

..........................................

Anyone can help me out?

Thank you!

1 ACCEPTED SOLUTION

jesusnava
Giga Expert

Thank you everyone, here is the answer:

----------------------------------------------------------------

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

if ( g_form.getValue("priority") == 1 ) {


g_form.getElement("number").setStyle({color: "red"});


}
}

----------------------------------------------------------------

View solution in original post

16 REPLIES 16

find_real_file.png

 

find_real_file.png

Priyanka Gupta
Mega Guru

Try- 

if ( g_form.getValue("priority") == 1 ) {

     g_form.getElement("number").style.color= "red";
}

 

Here are the screenshots-

find_real_file.png

 

Incident Number changes to Red when Priority changes to P1-

find_real_file.png

 

Hope this helps!

jesusnava
Giga Expert

Thank you everyone, here is the answer:

----------------------------------------------------------------

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

if ( g_form.getValue("priority") == 1 ) {


g_form.getElement("number").setStyle({color: "red"});


}
}

----------------------------------------------------------------

jesusnava
Giga Expert

thank you all for your comments and help!!

Hi,

Could you please proceed by marking appropriate answer as correct and close the thread 🙂

This will help others with same issue to find correct answer.