How to change the color of a field under certain conditions

AMY59
Tera Contributor

Hi,all

I would like to know How to change the color of a field under certain conditions.

If the value 2 exceeds the value 1, I want to set the color of any field to change.

(If the VALUE2 is 1000,and VALUE1 is 500,than Additional comments (Customer visible) field color changes yellow)

find_real_file.png

I would appreciate it if you could tell us how to implement it because I don't know how to implement it.

Best Regards,

Amy

1 ACCEPTED SOLUTION

Martin Ivanov
Giga Sage
Giga Sage

Go to the field you want to change value, right click, configure styles

find_real_file.png

then using javascript you can build your condition and using css you can define your colouring

find_real_file.png

Please Mark Correct AND Helpful. Thanks!


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

View solution in original post

5 REPLIES 5

Martin Ivanov
Giga Sage
Giga Sage

Go to the field you want to change value, right click, configure styles

find_real_file.png

then using javascript you can build your condition and using css you can define your colouring

find_real_file.png

Please Mark Correct AND Helpful. Thanks!


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

Thank you for your reply.

Also, does the following code meet the requirements?

Value

javascript: current.disposition== u_integer_1>u_integer_2

Style

background-color:#FFFF00

javascript: current.u_integer_1>current.u_integer_2


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

NOTE: this will work after the record is saved


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024