Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Change color of each choices in a choice field dropdown

divyavashishtha
Tera Contributor

How can i change color of each choices in my choice field dropdown.   eg.,

find_real_file.png

Thanks in advance!

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee

Hi Pradeep,


Thanks for the response. but its not working.


hvrdhn88
Giga Patron

Not applicable

Hi,

Please find the below script to change the choice option background and foreground colors:

Syntax: g_form.getOption("fieldname", "option_value").style.color = "color value";

 

Example:

g_form.getOption("colors", "red").style.backgroundColor = "yellow";
g_form.getOption("colors", "red").style.color = "red";

 

Thanks,

Ravinder