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.

How to change the background color of the field

Nagesh5
Tera Contributor

Hello Community,

How to change the background color of the field if caller is not empty.

 

Thanks,

Nagesh

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hello Nagesh,

You can use field styles to change color of the field. 

Refer to this link for more information.

https://docs.servicenow.com/bundle/rome-platform-administration/page/administer/navigation-and-ui/ta...

Also, you can write onload client script

function onLoad() { 
  //Type appropriate comment here, and begin script below 
  var element = g_form.getElement('number'); 
  element.style.backgroundColor = "red"; 
}

View solution in original post

1 REPLY 1

asifnoor
Kilo Patron

Hello Nagesh,

You can use field styles to change color of the field. 

Refer to this link for more information.

https://docs.servicenow.com/bundle/rome-platform-administration/page/administer/navigation-and-ui/ta...

Also, you can write onload client script

function onLoad() { 
  //Type appropriate comment here, and begin script below 
  var element = g_form.getElement('number'); 
  element.style.backgroundColor = "red"; 
}