- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2015 02:57 PM
I am looking for a some coding help...as this is not my strong suit. I am using a Catalog Item to display different System Access variables in check box variables. We are building templates of what should be set to true for each employee based on their position. Those defaulted 'true' check boxes we are wanting to highlight. I've been able to do all of this so far by hard coding:
g_form.setValue('variable_name'), true;
g_form.getControl('variable_name;).parentNode.style.backgroundColor = 'LightBlue';
I would rather not hard code each variable name to highlight when the variable is 'true'. Could anyone help me with how to reference all the variables, see which ones are true and then highlight those? Is this even possible or is hard coding the only way to go?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 09:13 AM
This would work now in Fuji ..
jQuery('input[type=checkbox].cat_item_option:checked').each(function(){
(jQuery(this).parent().parent().css( "background-color", "LightBlue"));
}
);
But future upgrades , I am not sure

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 03:22 AM
Hi Lindsey,
You could modify the scripts provided in this great article http://www.servicenowguru.com/scripting/business-rules-scripting/hide-empty-variables-standard-form/
Rather than checking for empty variables you could check the ones that you need and later in the client script you could change the back-ground color for these variables.
Hope that helps.
Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 06:48 AM
Hi Mandar,
Thanks for your reply! I have used this business rule and client-script to hide empty variables on other records. I did consider this at first but where would this business rule sit, on the Catalog Item table? The highlighting will take place on the Catalog Item before it's passed to any kind of record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 09:13 AM
This would work now in Fuji ..
jQuery('input[type=checkbox].cat_item_option:checked').each(function(){
(jQuery(this).parent().parent().css( "background-color", "LightBlue"));
}
);
But future upgrades , I am not sure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2015 10:49 AM
This worked great for the check boxes. I'm also wanting to do this with the select boxes I have on the form if the values is not 'standard_choice'. Would it be jQuery('input[type=selectbox].cat_item_option.value:not sure what to put here for does not equal 'standard_choice'').each(function(){