Getting list collector display value, not sys_id on catalog item with script.

Brandon Smith3
Kilo Expert

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.

3 REPLIES 3

diegosantiago
Kilo Expert

what about the getDisplayValue()?


Diego,


getDisplayValue() is returning undefined. Thank you though.


ghsrikanth
Tera Guru

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));



Screen Shot 2016-04-08 at 6.34.56 PM.png



Hopefully this helps