Change field colour based on values in another related field

richofing
Mega Contributor

I have a requirement to change the color of the text in a field based on the value in another, related field. In this case it is the software license user entitlement.   I want to display the user name in red if the user has a non active state. For example, in the screen shot below, if Abel's Active status is false, I want to display his name in the User Entitlement list in red.

Thanks!

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Ric,


I was unable to get the color of the text to change to red. I think that may be related to the fact that this is a link, but you can change the background color. Here's what I did:


Navigate to Asset > Software > User License Entitlements.


Right-click any column header and select Configure > All.


Go to the Styles tab. (this is what Robert references in the wiki).


Complete the form as follows:


Screen Shot 2016-08-19 at 4.26.10 PM.JPG


This has the following result in the list view for inactive users:


Screen Shot 2016-08-19 at 4.28.25 PM.JPG



If you would like it to be a bit more "in your face," you can turn off "Modern cell coloring" in the list preferences. This is a per user setting, though. It makes this look like this:



Screen Shot 2016-08-19 at 4.30.17 PM.JPG


I hope this helps.



Ben


View solution in original post

8 REPLIES 8

Uncle Rob
Kilo Patron

Bonjour Monsieur Hofing,



You'll want to leverage Field Styles:   Defining Field Styles - ServiceNow Wiki


There's lots of great examples on the platform already in the field style list.


Community Alums
Not applicable

Ric,


I was unable to get the color of the text to change to red. I think that may be related to the fact that this is a link, but you can change the background color. Here's what I did:


Navigate to Asset > Software > User License Entitlements.


Right-click any column header and select Configure > All.


Go to the Styles tab. (this is what Robert references in the wiki).


Complete the form as follows:


Screen Shot 2016-08-19 at 4.26.10 PM.JPG


This has the following result in the list view for inactive users:


Screen Shot 2016-08-19 at 4.28.25 PM.JPG



If you would like it to be a bit more "in your face," you can turn off "Modern cell coloring" in the list preferences. This is a per user setting, though. It makes this look like this:



Screen Shot 2016-08-19 at 4.30.17 PM.JPG


I hope this helps.



Ben


Thank you, Robert and Ben, that answered my question perfectly!



Ric


Hello, I have a similar case use and I have applied your code concept but without success.

What I am trying to accomplish is when Business criticality is a 1 then make the background color red (tomato).

Please take a look and let me know if you can see what I am missing or doing wrong, thank you!

find_real_file.png

find_real_file.png