- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2021 05:59 AM
Hello everyone
I've been trying to get a UI script working without not much of a success.
SN's documentation in this regards do not cover all aspects of its potential usage. I've gone through all forum posts here, including: this and many others
Can anyone suggest what am I doing wrong ?
UI Script
<scope> = <scope> || {};
<scope>.<name>= (function initializeLibrary(g_form) {
var _localVariable = '';
function _localFunction() {
//do something
}
function _localFunction2() {
//do something
}
var functionToCall= function doProcessChanges(fieldName) {
//call local functions
//call AJAX
};
return {
processPhasingChanges: functionToCall
};
})(g_form);
onLoad Client Script order - 100
ScriptLoader.getScripts('<scope>.<name>.jsdbx');
onChange Client Script: order - 200
tried all variations, such as
- <scope>.<name>.processPhasingChanges
- processPhasingChanges
- <name>.processPhasingChanges
None seems to work. Any help is much appreciated
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2021 06:13 AM
Hi,
check out these links which have solution
How to call UI Scripts from Client Scripts
[SOLVED] How to call scoped UI script from catalog client script ?
Regards
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-17-2021 06:13 AM
Hi,
check out these links which have solution
How to call UI Scripts from Client Scripts
[SOLVED] How to call scoped UI script from catalog client script ?
Regards
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-17-2021 06:48 AM
Thanks
tried using
g_ui_scripts.getUIScript('foo.bar').then(function(script) {
script.helloWorld();
});
but I get onChange script error: ReferenceError: g_ui_scripts is not defined function() { [native code] }Note that both my UI script and Client script is in scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2021 07:00 AM
Hi,
I remember I used either of the link to get it work
try the 2nd link
Regards
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-17-2021 07:13 AM
None of them works in my case... it's just kind of sad there is almost no documentation available and you have to spend hours to get the syntax working...