Change Reference Field Background Color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 08:55 AM
I am trying to set the background color on a reference field. I am able to set the color of other fields but just not reference fields.
Here is what I using to set other fields.
I am doing this via a client script.
var cff = g_form.getControl(fieldname);
cff.style.backgroundColor = 'lightgreen';
Any help would be appreciated.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 09:04 AM
Check this:
https://www.servicenowelite.com/blog/2013/11/24/custom-field-styles
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 09:09 AM
As vkachineni mentioned, Field Styles are another, simpler, option.
Right click the field label, select Configure Styles. Create a New Style and in the Style field enter:
background-color: lightgreen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2021 07:52 AM
The problem here is the getControl() method doesn't work for reference fields.
Use getDisplayBox instead...
g_form.getDisplayBox('reference_field').style.backgroundColor = 'green'
See here for this information on Now Support: