- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 05:06 AM
Hi.,
I want to call a global UI Script from a scoped application.
But I keep getting the following error.
What's wrong?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var segmenter = new global.TinySegmenter(); }
Thanks in advance,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 05:28 AM
Hi,
You can use ScriptLoader
ScriptLoader.getScripts(['scripts/get_wsdl_url.js'], function() { });
https://developer.servicenow.com/dev.do#!/reference/api/madrid/client/c_ScriptLoaderAPI
If my answer helped you in any way, mark answer as helpful and correct.
Thanks and regards,
Megha.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 05:22 AM
Hi,
I could see you are using new operator
you can directly call the function within UI script
Also did you set UI Type as ALL for your client script?
please share code
Thanks
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
06-19-2020 05:38 AM
Hi,
Thank you for your comment.
UI Script works on Global.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 05:51 AM
Hi,
can you call it like this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var segmenter = TinySegmenter();
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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
06-19-2020 05:59 AM
Hi,
error..
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 08:06 AM
Hi,
check if these link helps
https://developer.servicenow.com/dev.do#!/reference/api/madrid/client/c_ScriptLoaderAPI
if not then
Looks like creating reusable UI Scripts in a scope will not work. I created a global UI script in the Global scope so that it can be used in a client script of custom scoped application.
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader