- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 01:46 PM
I am trying to hide a list collector on my catalog item at form load but it does not seem to be working. This is a fairly easy thing to do and it works great for other controls but not the list collector. Any ideas?
I've also posted on a related thread in hopes that those folks might have an idea.
Other thread: https://community.servicenow.com/thread/194246?q=list%20collector%20hide
Details:
I have a Catalog Item setup.
The list collector is on the form and works.
If a user selects a particular value from a dropdown on the form then the list collector (and some other variables) should be visible and mandatory.
I have a UI Policy setup for this and it works wonderfully for the variables except the list collector.
When the form loads, the variables are all hidden/visible/mandatory as expected except for the list collector which remains visible.
The list collector does become mandatory as expected too!
Thanks for any advice you may have! As always, I am willing to do a screen share if anyone is interested in taking a look.
(I have google hangouts for this)
I've also attached a screen of the UI Policy.
Regards,
Michael
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 01:57 PM
Take a look at this article: http://www.servicenowguru.com/scripting/client-scripts-scripting/changing-filter-list-collector-vari...
There is a section for hiding the list collector until filters are present:
function onLoad() {
//Apply a default filter to the list collector variable
var collectorName = 'configuration_items';
var filterString = 'name!=NULL^sys_class_nameANYTHING';
//Hide the list collector until we've set the filter
g_form.setDisplay(collectorName, false);
setCollectorFilter();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 01:57 PM
Take a look at this article: http://www.servicenowguru.com/scripting/client-scripts-scripting/changing-filter-list-collector-vari...
There is a section for hiding the list collector until filters are present:
function onLoad() {
//Apply a default filter to the list collector variable
var collectorName = 'configuration_items';
var filterString = 'name!=NULL^sys_class_nameANYTHING';
//Hide the list collector until we've set the filter
g_form.setDisplay(collectorName, false);
setCollectorFilter();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 02:07 PM
That comment pointed me to the right spot! Thank you!
I was actually already using this exact script. The part that was causing me a problem was that the line:
//g_form.setDisplay(collectorName, true);
was clashing with my UI Policy by always making the list collector visible regardless of what the UI Policy was trying to do. Commenting out that line did the trick.
Thank you!