Background colour in fields

Sanel
Tera Expert

Hi all ,

I want to add some background colours to some fields based on the score in some another field.For e.g the score fields value is 1-5 then the background colour should be green and if between 6-10 it should be yellow.

How can I add colours in the background?

1 ACCEPTED SOLUTION

Phil Swann
Tera Guru
Tera Guru

Hi all, no need for client scripts ! 

This can be done using the field styles. https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/navigation-and-ui/task/t_DefineFieldStyles.html

 

Take the example of Control, being compliant/non-compliant , in List view:

find_real_file.png

Or Compliance Score Percentage:

find_real_file.png

in navigation bar type sn_compliance_policy.config and look at the styles list:

find_real_file.png

you will notice, use of javascript: which enables you to access the current record fields and perform some logic. if this returns true, the style will be applied

find_real_file.png

View solution in original post

5 REPLIES 5

Hi Phil 🙂

Just found this post while looking for something similar. I believe this is only true if the field is rendered as read-only.

I've not found a supported way to apply background colours to fields on the form if the field is editable.

Having said this, I am struggling to think of a use case for a colouring an editable field.

All the best