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-14-2020 06:26 AM
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
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-16-2020 08:19 PM
is there any way to rewrite this in ur servicenow script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 08:39 PM
Hi,
you want onchange on list collector field to work?
What is your exact requirement here?
Regards
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
01-16-2020 09:29 PM
the gel functionality of on change client script is not working on portal..
i need a code which replace the same code