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 particular choice value in CSM/FSM Workspace

Sanket Kutwal
Tera Expert

Hello Folks,

 

Anyone knows that how to set the color to specific choice value? in CSM/FSM Workspace

 

As you can see below when the form loads i want to set the red color to Sub Category value.(Check the highlighted text in below image).

 

 

SanketKutwal_1-1709717340798.png

 

 

 

5 REPLIES 5

Service_RNow
Mega Sage

Hi @Sanket Kutwal 

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

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

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

    //Type appropriate comment here, and begin script below

}

Please mark reply as Helpful/Correct, if applicable. Thanks!

tried but didn't worked

 

SanketKutwal_0-1709718153996.png

 

SanketKutwal_1-1709718177363.png

 

SanketKutwal_2-1709718195986.png

 

SanketKutwal_3-1709718298458.png

 

 

 

Hi @Sanket Kutwal 

please replace your code line 9 

control.style = 'background-color: red';

Please mark reply as Helpful/Correct, if applicable. Thanks!

Hi, @Service_RNow 

 

I want to set the text color not background color, that's why i have written that code over there.

 

control.style = 'color: red';