Alternative Method for gel(); Functionality in Client Script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2020 06:59 AM
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.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2020 08:59 PM
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_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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 01:25 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2020 10:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 01:12 PM
Could u please let me know where should i use this line.
Thanks