Getting list collector display value, not sys_id on catalog item with script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 05:17 PM
Is there any way to get the display values of the right list collector in a catalog item with a Catalog Script? I am trying to use g_form.getValue but it only returns the sys_ID.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 06:04 PM
what about the getDisplayValue()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 05:28 AM
Diego,
getDisplayValue() is returning undefined. Thank you though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 06:07 AM
You can use the below code to get the Display Values -
var varName = "userlist"; //list collector variable name
var leftBucket = gel(varName + '_select_0');
var rightBucket = gel(varName + '_select_1');
var selectedOptions = rightBucket.options; //get the options in right bucket
var opt = [];
for(var j = 0; j < selectedOptions.length; j++){
opt.push(selectedOptions[j].innerHTML);
}
alert(JSON.stringify(opt));
Hopefully this helps