Reference Field Background Colour
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 02:27 PM
Hi
I am hoping someone may be able to help with an issue I am having. I am attempting to conditionally change the background colour of reference fields in forms and in lists. I have succeeded on the base form and list using Client Script and Style. Where I have included the field in question on other forms for information I am not able to affect the style.
I have attempted to force a visual change using the following code in a client script, but there was no change:
function onLoad() {
//Type appropriate comment here, and begin script below
var myField = 'u_version_number';
var ctrl = $('sys_display.' + g_form.getControl(myField).id);
ctrl.style.backgroundColor = 'yellow';
}
Our version is London. Any help would be appreciated, I guess I am missing something very basic!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2019 04:29 PM
It sounds like this is working, but it's not working when you're adding the field as a derived field to the form through another reference field. If that's the case, you just need to dot-walk an extra step through the first reference field to get the correct ID.
var myField = 'NAME_OF_FIRST_REFERENCE_FIELD_HERE.u_version_number';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 03:29 PM
Thanks for replies I got it working as follows (the dotwalk was incorrect and the syntax had to be changed):
g_form.getControl('sys_display.task_ci.u_version_number').style.backgroundColor = "yellow";