- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 06:20 AM
Hello all,
I'm trying to pass the sys_id form CI UI Action button to catalog item. That part is working. I want to auto populate the right slushbucket with the CI sys_id that was passed. For some reason one of my highlighted statements (in client script below) does not work. I got the example from servicenowguru.
Here's the slush bucket.
Here's my client script in catalog item. The gel function does not work.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 07:23 AM
Hi,
since your script is using gel which is not recommended you need to set isolate script to false for that onload client script; this field is not available on form but from list layout you can set it to false; by default it is set to true
making it to false would allow gel() and DOM manipulation script to work
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
03-27-2020 07:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 07:23 AM
Hi,
since your script is using gel which is not recommended you need to set isolate script to false for that onload client script; this field is not available on form but from list layout you can set it to false; by default it is set to true
making it to false would allow gel() and DOM manipulation script to work
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
03-27-2020 08:36 AM
Hi Ankur,
Since I have the sysid of CI in that first alert in code above, how would I get that to the rightBucket?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2020 12:14 AM
Hi,
So you are getting the comma separated sys_ids from the url; now you want to populate the right side of slush bucket with this?
So do this
function onLoad(){
var gURL = new GlideURL();
gURL.setFromCurrent();
var sysId = gURL.getParam('sysparm_cisysid');
var array = sysId.toString().split(',');
addItemstoList('select_cis',array);
}
function addItemstoList(listCollector, groupList) {
var varName = listCollector;
var leftBucket = gel(varName + '_select_0');
var rightBucket = gel(varName + '_select_1');
var rightOptions = rightBucket.options;
var rightIDs = [];
//Remove --None--
//for (var i = 0; i < rightOptions.length; i++) {
var value = rightOptions[i].innerHTML;
if (value == '--None--') {
rightBucket.remove(0);
}
//}
// Add new options
if (groupList != null) {
var myCIArray = groupList.split(',');
for (var j = 0; j < myCIArray.length; j += 2) {
addOption(rightBucket, myCIArray[j], myCIArray[j + 1]);
sortSelect(rightBucket);
leftBucket.onchange();
}
}
// sort the buckets
sortSelect(rightBucket);
}
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