How to add data into right side of slush bucket instead of Left

KB18
Tera Guru
Tera Guru

Hi Team,

I am looking for an data to be add to the right side of slush bucket instead of Left.

I am using below line to add, but not working

slush.addRightChoice(item.getAttribute('value'), item.getAttribute('text'));

Kindly help to add data   into right side of slush bucket instead of Left

Regards

KB

Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas
3 REPLIES 3

paramveer
Mega Guru

Hi Kailas,


Use below code in onload/onchange client script :



http://www.servicenowguru.com/scripting/client-scripts-scripting/move-list-collector-options/



var varName = 'server_list';


var leftBucket = gel(varName + '_select_0');


var rightBucket = gel(varName + '_select_1');


if(rightBucket.options.length == 1 && rightBucket.options[0].text == '--None--'){


      rightBucket.options.length = 0;


}


var selectedOptions = leftBucket.options;


//Get an array of all option IDs to move


var selectedIDs = new Array();


var index = 0;


for(var i = 0; i < selectedOptions.length; i++){


    selectedIDs[index] = i;


    index++;


}


//Move all returned options from right to left bucket and sort the results


//Switch 'rightBucket' and 'leftBucket' to move from left to right


moveSelectedOptions(selectedIDs, leftBucket, rightBucket, '--None--');


//Sort the resultant options in the left bucket


sortSelect(rightBucket);



If you want some default value should be present in slush bucket, then you can configure the default value of slush bucket by configure dictionary. Slush bucket takes comma separated sys_ids(like :sys_id1,sys_id2.sys_id3). so in default value you just need to give some sys_ids, it will automatically show those records selected in right hand side.



Thanks,


Param


Hi Paramveer,



Thanks for the update.



I want to know while loading the slushbucket, I want my data should be populate into Right Side instead of Left side slushbucket.



Regards




KB


Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas

zoltanszabo
Tera Contributor

var varName = 'NAME OF YOUR LIST COLLECTOR VARIABLE';


var rightBucket = gel(varName + '_select_1');


rightBucket = new Option(DISPLAY VALUE OF RECORD, sysID OF RECORD);


sortSelect(rightBucket);