- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2013 04:22 PM
I've seen a lot about how to default the filter for a list collector (pre-filling the "left side"), but I can't seem to find anything about defaulting the selected values of a list collector (to pre-fill the "right side"). The closest I came was unfortunately a dead end: How to pre-populate a collection list?
In that post, it was suggested that you should be able to set list collector selections by using the standard g_form.setValue() method (http://wiki.servicenow.com/index.php?title=GlideForm_%28g_form%29#setValue), but I can't get that to work:
// This should work, according to the Wiki: g_form.setValue('watch_list', '1', 'Michael McCall'); // assuming that '1' were actually my sys_id value // However, having this in a catalog client script does not work: g_form.setValue('requested_users', '1', 'Michael McCall'); // assuming that I have a list collector variable named "requested_users"
Is it just not possible to programmatically set list collector values, or is there a special method for doing so? (I might guess it has something to do with the g_filter object, but I can't find any information about that object beyond the setFilter() method.)
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2013 11:17 AM
List collector's are very different.
I think Mark Stanger's post is probably the easiest to follow;
http://www.servicenowguru.com/scripting/client-scripts-scripting/move-list-collector-options/
the tl;dr is that there are two functions available
and
moveSelectedOptions(selectedIDs, rightBucket, leftBucket, '--None--')
sortSelect(leftBucket)
These should let you move stuff around, and re-sort the left or right objects.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2013 11:17 AM
List collector's are very different.
I think Mark Stanger's post is probably the easiest to follow;
http://www.servicenowguru.com/scripting/client-scripts-scripting/move-list-collector-options/
the tl;dr is that there are two functions available
and
moveSelectedOptions(selectedIDs, rightBucket, leftBucket, '--None--')
sortSelect(leftBucket)
These should let you move stuff around, and re-sort the left or right objects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2013 09:29 AM
Thanks, Jace! I spent a little bit of time playing around with the scripts from Mark's page, and it looks like I can accomplish what I wanted.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2013 07:19 PM
I'm glad it helped. Those list collectors can be quite complicated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2016 12:34 AM
Hi Jace,
I cannot open this url (http://www.servicenowguru.com/scripting/client-scripts-scripting/move-list-collector-options/), permission issue, if you can open it, could paste the script here pls?
Regards
Yogish