Getting selected values in a list collector catalog variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2016 11:25 AM
One of the variables in my catalog item is a list collector. This list collector permits users to select records (move from left to right) to be de-activated. Upon submit (I will use a On Submit client script), I want to loop through the selected value(s) in the list (right-side of the list); then I will find the appropriate record in the table and set Active = false. I know how to update the record (GlideRecord), and how to code a loop, but I am not certain how I get the Selected values into an arry. Thanks!
Ric

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2022 07:39 AM
For better performance may help specialized addQuery() operator: "IN"
var GR = new GlideRecord('my_table');
var myList = g_form.getValue('my_variable');
GR.addQuery('sys_id', 'IN', myList );
GR.query();
while (GR.next()) {
// Do what you want to the retrieved record
GR.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2023 01:57 AM
Hello Chuck,
I have List Collector in catalog item, I am trying get the value of this using g_form.getValue() but it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2019 02:14 AM
You can also use the following way:
var options = $j('#delegate_roles_roles_select_0 option');
var values = $j.map(options ,function(option) {
return option.text;
});
console.log(values);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 07:32 AM
Chuck,
If you are still around, is my_table literally what you meant to specify or is that a placeholder for something else?
What converts the selected values sys_id's to a real human readable value?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 06:17 AM
sys_ids are converted to readable values based on the table they are referencing. One field is designated as the display value (e.g. sys_user.name or task.number). With a list field, you must do a (GlideRecord) lookup yourself if you want to display the display values for the referenced records. Fairly easy on a server script, a bit more work on a client script.