How to highlight a field red on particular value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2017 06:04 AM
Hi Team,
How to highlight a field RED when it equal to value 1111.
I need to highlight below mentioned field with red color, when it is equal to 1111.
This is a derived field, when ever the caller changes this value also get changes.
Any Suggestion or Help.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2017 09:40 AM
Hi Abhay,
Add this in value field directly i.e. 1111 without double quotes
"javascript: " is used only when you want to execute some condition and if "javascript: " is used then this value field expects boolean true/false.
If the value field is evaluated to true then style is applied.
If the value field is evaluated to false then style will not be applied.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
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
01-23-2017 06:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2021 02:10 AM
Hi,
This is an old post but i am posting here to help all the users who still have this requirement.
Please use 'g_form.getDisplayBox()' function. This is an existing ServiceNow function and can be very helpful in this situation.
ex - g_form.getDisplayBox(fieldName).setAttribute('style', 'color:red');
Replace 'fieldName' with your field's name and it will highlight that field value in red color.
Thanks,
Himani