Alternative Method for gel(); Functionality in Client Script ?

Chaithu3
Tera Contributor

Hi All,

The client script were written for on change the variable ( list collector) by using the gel(); method .

is there any possibility that to rewrite the code in java script ?

the gel(); functionality doesn't work in service portal.

 

The code is given below :

 

function onChange(control, oldValue, newValue, isLoading) {

if (isLoading || newValue == '' || newValue != 'just_add_me') {
return;
}

//Name of variable to move options from
var varName = 'users';
var leftBucket = gel(varName + '_select_0');
var rightBucket = gel(varName + '_select_1');
var selectedOptions = rightBucket.options;
var selectedLeftOptions = leftBucket.options;

//Get an array of all option IDs to move
var selectedIDs = [];
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, rightBucket, leftBucket, '--None--');
//moveSelectedOptions(g_user.userID, leftBucket, rightBucket);
//Sort the resultant options in the left bucket
sortSelect(leftBucket);
}

 

 

 

 

 

 

Thanks ,

Chaithu.

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Any update on this?
Can you mark answer as correct, 👍 helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

is there any way to rewrite this in ur servicenow script ?

Hi,

you want onchange on list collector field to work?

What is your exact requirement here?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

the gel functionality of on change client script is not working on portal..

i need a code which replace the same code