Field styles in Form view

amaradiswamy
Kilo Sage

Hi All,

I have defined a style by using javascript:condition in the "Value field" of "Field Styles" to set the background color. It was working fine but the style is working only in the LIST view, when i open the form then the field on the form is normal and no background color was applied for that.

Please kindly advice on this?

Thanks & Regards,

swamy

16 REPLIES 16

rgm276
Mega Guru

Fuji changed a lot of the CSS formatting, but you can always do this in a client script



for example: This script



client_script_colorCapture.JPG


will have this result on the form


client-scriptCapture.JPG


there are a couple of other community threads you can view as well on scripting options


Custom Field Styles


Re: I want to set the color of text in short description field and choice list field.


Hi Mitchell,



Thanks for your reply. I am setting the background color to a field if the current time is exactly 15 min before the date and time selected in "Date and time of execution" (future date) field. so   can i   access glidetime objects in client script. Please advice on this?



Regards,


Swamy


The SN Nerd
Giga Sage
Giga Sage

Have you tried suffixing !important on the field style make it work on forms?



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Hi Morris,



Thanks for your reply.


Where i have to include !important (in value field or styles definition)



Regards,


Swamy