Get display values from a list collection in a catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 01:21 AM
Hello,
How can I get the diplayed values of a list collector ,instead of sys_id, in a catalog item, without a gliderecord to resolve the sys_id.
I tried :
alert(g_form.getDisplayBox("mylistcollector").value);
alert(g_form.getDisplayBox("mylistcollector"));
alert(g_form.getValue("mylistcollector"));
alert(g_form.getDisplayValue("mylistcollector"));
alert(g_form.getReference('mylistcollector'));
var list= g_form.getReference('mylistcollector', getList);
function getList(list) {
alert('gg ' + list.name);
}
Either it does not work, or I have the sys_id
Here is my list collector
Thank you
Clement
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 01:51 AM
Hi,
Please go through below thread it may help your requirement
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 05:16 AM
Thank you but I Have this error
on this line
var varName = "mylistcollector"; //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));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 01:56 AM
Hi
Please go through following links, Mark my answer as correct if that helps.
https://community.servicenow.com/community?id=community_question&sys_id=2dc80b61db5cdbc01dcaf3231f96196c
https://community.servicenow.com/community?id=community_question&sys_id=36338be1dbd8dbc01dcaf3231f961954
https://community.servicenow.com/community?id=community_question&sys_id=941cc185db179f400be6a345ca961954
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 05:58 AM
https://community.servicenow.com/community?id=community_question&sys_id=2dc80b61db5cdbc01dcaf3231f96196c
As explained in my demand , I don't want to use gliderecord on the client side for perfomance reason. I'll use it at last resort
https://community.servicenow.com/community?id=community_question&sys_id=36338be1dbd8dbc01dcaf3231f961954
I have the same error as above on the option attribute
onSubmit script error: TypeError: Cannot read properties of null (reading 'options'):
var arr=[];
var select_id=$('mylistcollector_select_1');
for(i=0; i<select_id.options.length; i++){
arr.push(select_id.options[i].text);
}
alert(arr);
https://community.servicenow.com/community?id=community_question&sys_id=941cc185db179f400be6a345ca961954
var varDisp = g_form.getDisplayBox(g_form.resolveNameMap(“mylistcollector”)).value;
This is the only line of code I haven't tried but it does not work. The alert display show me an empty popup
Thank you