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.

change color of service field

rampage
Tera Contributor

Help me do this please : 

 

Inform operators that the impacted Service is critical:
When the “Impacted Service” is “Critical”, the name of the service is displayed in Red
If the impacted service is “Medium Criticality” the service name is orange

1 ACCEPTED SOLUTION

Harsh_Deep
Giga Sage
Giga Sage

Hello @rampage 

 

Use this for your reference-

 

==========================CLIENT SCRIPTS============================

Table - Incident
Type - OnChange of Category Field
Scripts -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
control.style = 'background-color:';
return;
}

switch (newValue) {
case "inquiry":
control.style = 'background-color: green';
break;
case "software":
control.style = 'background-color: orange';
break;
case "hardware":
control.style = 'background-color: yellow';
break;
case "database":
control.style = 'background-color: brown';
break;
case "network":
control.style = 'background-color: red';
break;
}

//Type appropriate comment here, and begin script below

}

 

If this helped you in any way, please mark this as BOOKMARK, SUBSCRIBE & HELPFUL & Accept Solution.

 

Best Regards,

Harsh

View solution in original post

2 REPLIES 2

Jaspal Singh
Mega Patron
Mega Patron

Hi,

You need Field style. Give doc link a check.

Harsh_Deep
Giga Sage
Giga Sage

Hello @rampage 

 

Use this for your reference-

 

==========================CLIENT SCRIPTS============================

Table - Incident
Type - OnChange of Category Field
Scripts -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
control.style = 'background-color:';
return;
}

switch (newValue) {
case "inquiry":
control.style = 'background-color: green';
break;
case "software":
control.style = 'background-color: orange';
break;
case "hardware":
control.style = 'background-color: yellow';
break;
case "database":
control.style = 'background-color: brown';
break;
case "network":
control.style = 'background-color: red';
break;
}

//Type appropriate comment here, and begin script below

}

 

If this helped you in any way, please mark this as BOOKMARK, SUBSCRIBE & HELPFUL & Accept Solution.

 

Best Regards,

Harsh