Gel is not working in portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 07:55 AM
Reset List collector and set according to location data in list collector working in ITIL view but not working in portal
Check below code:
var collectorName = '';
var filterString = '';
if (newValue != '') {
//Apply a filter to the list collector variable
collectorName = 'prod_access_to_approver_po_enabler_role';
filterString = 'u_region=' + newValue;
//alert("in onchange" +filterString );
// Gets the right column of the List Collector
var rightBucket2 = gel(collectorName + '_select_1');
// Loops through all the selected entries and remove them
while (rightBucket2.firstChild) {
if (rightBucket2.firstChild != null && rightBucket2.firstChild != '') {
rightBucket2.removeChild(rightBucket2.firstChild);
}
}
//Find the filter elements
var fil = gel('ep');
//Hide the filter elements
// fil.rows[0].style.display = 'none';
// fil.rows[1].style.display = 'none';
// fil.nextSibling.rows[0].style.display = 'none'; //Filter description text
//Reset the filter query
eval(collectorName + 'g_filter.reset()');
eval(collectorName + 'g_filter.setQuery("' + filterString + '")');
eval(collectorName + 'acRequest(null)');
setTimeout(setCollectorFilter, 1000);
}
var collectorName1 = '';
var filterString1 = '';
if (newValue != '') {
if (newValue == 'Africa')
{
newValue="Africa";
}
else if (newValue == 'America')
{
newValue="America";
}
else if (newValue == 'Jakrata')
{
newValue="Jakrata";
}
//Apply a filter to the list collector variable
collectorName1 = 'prod_access_to_approver_po_derived_role';
filterString1 = 'u_region=' + newValue;
//alert("in onchange" +filterString );
// Gets the right column of the List Collector
var rightBucket21 = gel(collectorName1 + '_select_1');
// Loops through all the selected entries and remove them
while (rightBucket21.firstChild) {
if (rightBucket21.firstChild != null && rightBucket21.firstChild != '') {
rightBucket21.removeChild(rightBucket21.firstChild);
}
}
Below error is coming in Service Portal:
js_includes_sp.jsx:63718 (g_env) [SCRIPT:EXEC] Error while running Client Script "Set role according to Region": ReferenceError: gel is not defined
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:29 AM
hi,
gel is a jelly function . In service portal , you have to move all your code to UI Script and add the dependency to the your page ( See the Dependency menu in service portal ). So that you can access jQuery . After that, it is normal DOM manipulation using jQuery or vanilla javascript.
Thanks
- YLN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 09:40 AM
How i call in onchange client script??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:46 AM
jQuery wont be available in the client script runtime. It is only available in a widget's client controller and link function.
gel, as Dan said is a jelly function so it will also not be available in the portal.
Also, I believe that since the runtime for client scripts in the form or catalog form are isolated, even if you load it in as a UI script/ dependency those dependencies will not be available to use in a client script.
Vanilla JS is going to be your best option here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:49 AM
I didn't realize that. Thanks for the info Jesse and YLN.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 10:29 PM
Hi Piyush,
Instead of the above code , for setting the list collector use :
//arr[1] has the sys_id of the users
//arr[0] has the display name of the users
g_form.setValue('members', arr[1], arr[0]);
Please mark my answer helpful/correct if it answered your question.
Regards,
Swathi