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:10 AM
I'm pretty sure Gel is a jelly function, not a javascript one. Since the portal does not support jelly, you'll need to find a substitute. I'm surprised it doesn't give you a hard time for using eval() since that leaves you vulnerable to code injection.
Maybe you can find another way to bind to the html element that is more angular or jquery friendly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:15 AM
....maybe try replacing them with $j()
as in var rightBucket2 = $j(collectorName + '_select_1');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:20 AM
Error while running Client Script "Set role according to Region": TypeError: $j is not a function
giving error in service portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 08:26 AM
I'm not sure how jQuery is referenced in the Service Portal. $jQuery() should be safe.