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,

I consider this script for slush bucket and there are issues using this on portal side

check below links:

https://community.servicenow.com/community?id=community_question&sys_id=68dc31dfdbdbeb004abd5583ca96...

https://community.servicenow.com/community?id=community_blog&sys_id=571da2e5dbd0dbc01dcaf3231f961913

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

@Chaithu3 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Himanshu Dubey
Giga Guru

Hi Chaithu,

 

This might work

$('evelemt_id').getValue();

Please refer this http://prototypejs.org/learn/extensions.html

 

Please mark correct and helpful if it helps in any way

 

Thanks & Regards

Himanshu Dubey

Could u please let me know where should i use this line.

 

Thanks