Script Includes with UI Policies and Client Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 02:14 PM
I have a form with multiple UI Policies running scripts and also some onChange Client Scripts that all basically run the same script.
What I'd like to do is be able to store a single script somewhere and then call that from my UI Policies and Client Scripts. This way, if I need to make changes, I only need to do it in one place.
I've looked at Script Includes but from what I understand, that's server-side; while UI Policies and Client Scripts run Client-Side.
Is there anyway to accomplish this?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 02:24 PM
Ryan,
You can create a script include and call that from client side using GlideAjax. Check this out to learn about GlideAjax. If you need any help in scripting, I can help you out.
Thanks,
Abhinay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 02:31 PM
When you create your script include, remember to select the 'Client Callable' checkbox so these functions can be used in client script and UI policies.
Cheers,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 03:05 PM
Hi Ryan,
If you want to store client side script only in one place and call it from multiple UI Policies or Client Scripts running on the same table, you can create "On Load Client Script" and place the code there as separate function definition. Then the function is available for other scripts (UI Policy scripts or onChange scripts). This works only if those calling scripts run all on the same table (e.g. incident).
Also read about UI Scripts that allow to store reusable client script.
Cheers,
Dominik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 03:10 PM
Thank you all for your suggestions and rapid responses. I will give it a shot and let you all know how it goes!