List collector displays but does not store the selected values?

vanessaheux
Tera Contributor

Hello

I have a list collector variable in my catalog item for which values are selected via script implemented in a catalog client script “on load” on requested items (by moving selectedIds to right bucket dynamically).

When I load my requested item, I can check that the values are correctly displayed in the list of variables.

However, it seems that in my workflow, I’m not able to get the values selected of this list collector (list collector seems to be empty).

 I noticed also during my tests, that if I fill a manual value in the list collector on the catalog item view, and submit the request then:

  • The RITM will display the value implemented by the on load script
  • The logs will display the value selected manually on the catalog item view

This gives me the idea that my catalog client script proposes values selected but do not store them. But I don’t know how to proceed to store the values and not only display them.

Example

Catalog item view : I select manually value val1 in the list collector

I submit the request.

The “on load” client script on requested items runs and deletes all selected values of the list collector and imposes value val2 selected in the list collector.

I open the RITM created:

  • In the display of the variables I will see val2 (which means the on load client script worked, as it deleted the value val1 and proposes new value val2)
  • But in the logs, when displaying the values of my list collector, I will find the value val1 (the one selected initially and manually in the formular)

 

FYI : below the code used to fill dynamically the list collector 

function onLoad() {
//Type appropriate comment here, and begin script below

var varName11 = 'roles_to_add'; //"list1" is name of 1st list collector
var rightBucket11 = gel(varName11 + '_select_1');
var rightList11 = rightBucket11.options;

var varName2 = 'roles_to_add_final_list'; //"list2" is name of 2nd list collector
var rightBucket2 = gel(varName2 + '_select_1');
var rightList2 = rightBucket2.options ;

var selectedIDs11 = new Array();
for( var i = 0; i < rightList11.length; i++){
selectedIDs11[i] = rightList11[i].value;
}
removeListOptions(rightList11,rightBucket2); // remove none option
movetoList2(rightList11, selectedIDs11, rightBucket2);
}


function movetoList2(rightList1,selectedIDs, rightBucket2){
for(var i = 0; i < rightList1.length; i++){
// alert(selectedIDs[i]);
var us = new GlideRecord('u_verallia_roles');
us.addQuery('sys_id', selectedIDs[i]);
us.query();
while (us.next()){
var option = document.createElement("option");
option.value = us.sys_id;
option.text = us.u_value;
rightBucket2.add(option);
}
}
}

function removeListOptions(rightList1,rightBucket2){
rightBucket2.length =0;
}

1 REPLY 1

vanessaheux
Tera Contributor

Anybody can help me on this issue?