- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 03:01 AM
Hi All
I have a requirement to clear all the options selected in the right slush busket from a list collector when a variable say ' Customer' is changed instead of moving them to the left side because there is already an onchange script for the filter for every change of customer a set of new values get populated in the list collector. So when I change the customer the selected values in the list collector should disappear and show none .
Immediate help is appreciated.
this is for one customer when I change the customer it should be as shown below
Thanks
Zabee.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 05:17 AM
Try this:
OnChange of customer:
var varName = 'Name of your list collector';
var rightBucket = gel(varName + '_select_1');
var selectedOptions = rightBucket.options;
for(var i = 0; i < selectedOptions.length; i++){
//Check for the item to add here based on sys_id
var value = selectedOptions[i].value;
rightBucket.remove(value);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 03:54 AM
Onchange of customer you can do following:
window[collectorName + 'g_filter'].reset();
window[collectorName + 'g_filter'].setQuery(filterString);
in the filterString you can have a query for the changed customer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 04:23 AM
hi Mujtaba,
the above script would work for the filter to reset and populate it with new values but that's not the requirement. The selected customer names should disappear from right bucket when another customer is selected.
Thanks
Zabee.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 05:17 AM
Try this:
OnChange of customer:
var varName = 'Name of your list collector';
var rightBucket = gel(varName + '_select_1');
var selectedOptions = rightBucket.options;
for(var i = 0; i < selectedOptions.length; i++){
//Check for the item to add here based on sys_id
var value = selectedOptions[i].value;
rightBucket.remove(value);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 06:46 AM
This article maybe helpful:
» How to Move List Collector Options with a Catalog Client Script in Service-now