Changing field color based on Null Variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 12:11 PM
ok let me explain this better..
i have a Multi Line Text Field "Field1" and i am using that field to Turn the Color of the text and backgroud of another Date Field "Field2" if "Field1" is not NULL
I know i can do it with out code but our requirement is that we need "field1" not being null to turn it
i have tried the following
javascript:current.justification_for_urgent_request != "" ;
javascript:current.justification_for_urgent_request != '' ;
javascript:current.justification_for_urgent_request != null ;
javascript:current.justification_for_urgent_request != ;
but nothing seems to be working and i don't fully understand why... any thoughts
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2022 01:32 PM
Its javascript:, you have a ".", change it to a ":".
Or do what @Deepankar Mathur mentioned.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 04:47 AM
Thank you .. I have updated my question if you could read and answer that would be awesome.. thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 04:39 AM
ok let me explain this better..
i have a Multi Line Text Field "Field1" and i am using that field to Turn the Color of the text and backgroud of another Date Field "Field2" if "Field1" is not NULL
I know i can do it with out code but we need that Driver of "field1" not being null to turn it
i have tried the following
javascript:current.justification_for_urgent_request != "" ;
javascript:current.justification_for_urgent_request != '' ;
javascript:current.justification_for_urgent_request != null ;
javascript:current.justification_for_urgent_request != ;
but nothing seems to be working and i don't fully understand why... any thoughts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 04:47 AM
Hi,
the field style with value would work on list
how are you testing it?
this looks fine to me
javascript:current.justification_for_urgent_request != "" ;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 05:07 AM
once the script is in place i submit a request then open it and the color is not changing nor does it change if i open and existing request
if i keep everything but the script it works on new and existing requests so im trying to figure that out