- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 09:59 AM
Below is a screenshot of a very simple UI Action that uses jQuery to hide some form elements:
It works great when the application scope is Global, but if I create it so that its scope is that of a scoped application, it throws an error: Uncaught TypeError: jQuery is not a function
Looking at the rendered page's source code, the globally-scoped UI Action's JS is rendered as-is on the page:
<script>
function toggleRows(){
jQuery('.section-content .row').toggleClass('hide');
}
</script>
On the other hand, the scoped UI Action's JS seems to have additional code injected, which is what I believe is causing the errors:
<script>
addLoadEvent(function() {
var toggleRows = (function(GlideAjax,g_form,GlideDialogWindow,GlideRecord,window,document,$,jQuery,$$,$j,$F,gel,undefined){
"use strict";
function toggleRows(){
jQuery('.section-content .row').toggleClass('hide');
}
return toggleRows.bind(null)
})(ScopedGlideAjaxGenerator("x_bonm_bob"),ScopedGFormGenerator("x_bonm_bob"),ScopedGlideDialogWindowGenerator("x_bonm_bob"),null,null,null,null,null,null,null,null,null);
window.toggleRows = toggleRows;
});
</script>
Any idea what's happening here?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 10:31 AM
In scope we lose access to a number of things. This may not be a thorough explanation / bit o' help, but I recall this community post being helpful to me:
Importing your own jQuery or other client side library for your scoped app
- Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 10:31 AM
In scope we lose access to a number of things. This may not be a thorough explanation / bit o' help, but I recall this community post being helpful to me:
Importing your own jQuery or other client side library for your scoped app
- Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 12:38 PM
Hi Brian,
Creating the system property glide.script.block.client.globals did the trick. Thanks a lot for taking the time to help out!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 08:47 AM
Setting this property didn't work for me, as described here: Re: Use getElementById in catalog client script
Everywhere I see in this community is people using "scoped" applications. I never use them, I always use the "Global" scope for everything.
Does glide.script.block.client.globals ONLY work in "scoped" applications??