How to call a non global UI Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 08:30 AM
I made a UI Script that I want to call from several Client Scripts. When I make the UI Script global, it works and I can find it no problem. But I don't want it to be global obviously. When I put global to false though, it cannot find the class and/or function, so how can I call a non global UI Script?
As example,
UI Script:
var MyClass = Class.create();
MyClass.prototype = {
initialize: function() {
},
myFunction: function(value) {
return value;
},
type: 'MyClass'
};
Client Script:
var value;
new MyClass().myFunction(value);
The above works when it is global, but that doesn't sound right.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2016 01:09 PM
Hi Peter,
You'll want to use the ScriptLoader, and load your script in those specific places where you need it. I briefly touch on that in this answer:
Re: Unable to create UI Action that calls UI Script in Fuji Scoped Application
The ScriptLoader will load a given UI Script asynchronously, and you can provide a callback that should be executed after the script loads. It sounds like you want to use it in the same way as I described in that answer- load it so that its functions are available later on, when your onChange client scripts are called.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 02:27 PM
Need syntax example.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2022 02:45 PM