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

Community Alums
Not applicable

Hi Cory,

You have an extra cmdb_ci_service in your javascript. Your value should just be:

javascript:current.busines_criticality == '1 - most critical';

current in this cas is the cmdb_ci_service table. You only need to get the field value. In the example, above, we needed to dot-walk to get a value from a related table.

Ben

That worked!

Thank you!

Community Alums
Not applicable

You're welcome!

 

I do have one more question: It works on the Business service list view, however it does not work where I thought it would; on the Incident form.

 

So what I did next is to add Style to the Incident form (see below) but it did not work...

 

 

 

I should add that where I am ULTIMATELY going with this is the Status page on the Service Portal

 

 

any help will be greatly appreciated, thank you!