How to run UI Script from Catalog Client Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 07:55 AM
Sorry for such a basic question, but I'm not seeing it. It must be the time of day.
I created a UI Script, which is not global as I'm working in the HR scope. It has a custom made function sn_hr_core.gdf_hr_check_input, which returns another function.
So I thought I should call it by typing sn_hr_core.gdf_hr_check_input.checkRecordProducer(input) in the Catalog Client Script and that it would be loaded correctly. It seems I was wrong. Should I add some inclusion code maybe?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 08:05 AM
Hi Peter,
you can have many methods in your ui script and call them directly in any client side component:
example:
UI Script Name - globalMethods
function a(){
return 'test';
}
function b(){
}
in your client script you can directly call
var value = a();
Mark Correct if this solves your issue and also hit Like and 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
‎07-05-2017 08:09 AM
I'm working in the HR scope, so I cannot create global UI Scripts. How would it work for non-global scripts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 08:36 AM
I have been following this, as it seems exactly what I need, but no success
Client-side GlideRecord replacement for Scoped Applications (sort of)
This is the code I am using, but I do not get to success. I do not get derp either, so it's not continuing async either... What's going on...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 09:20 AM
Another update: It seems that ScriptLoader works for Client Scripts, but not for Catalog Client Scripts... fml... Loading a script is something so basic, why is this so difficult and undocumented?