- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2015 11:05 PM
This is more of a curiosity question rather than trying to solve a particular problem and I know best practice says always use ajax, yada yada. I was just trying to test a simple class create SI from a client script and thought I could declare and call the SI function without the ajax gubbins but I haven't had any joy. The SI call works as expected from server-side script so it's not syntax related - and the SI is client-callable. There are also a bunch of standard client-callable SI's which ship as standard... so
do I need to use GlideAjax with a SI I want to access client-side?
thanks!
David
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2015 12:05 AM
Hi David, actually in that thread I later mention i was wrong and confirmed that it's true that from the client you can only call a script include through a GlideAjax. The good news (in a way )... is that you have an alternative which is to use an asynchronous Glide Record to perform the same query you have in the script include.
Thanks,
Berny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2015 11:13 PM
do I need to use GlideAjax with a SI I want to access client-side?
No.
If you are looking to re-use client side code, you can create UI Scripts.
UI scripts provide a way to package client-side JavaScript into a reusable form, similar to how script includes store server-side JavaScript. Administrators can create UI scripts and run them from client scripts
and other client-side script objects and from HTML code.
If you are looking at retrieving data from the server (such as database queries) you should use GlideAjax if you want a maintainable ServiceNow instance.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2015 11:22 PM
Thanks Paul for the UI Scripts pointer - I'll check them out. Just to play devils advocate though - is it possible to call an SI client side? (without ajax)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2015 11:25 PM
Hi David, the following thread might be useful:
Re: How can I make a Script Inclide available for a client script without the ajaxcall ?
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2015 11:59 PM
Thanks Berny. I had a read through and you mention using a classless script include (getTableExtensions). I tried calling that as below:
var myObj = 'task'; | |
var foo = new getTableExtensions(myObj); | |
alert("Returned list is " + foo); |
but I get a
ReferenceError: global is not defined
I get the same if I strip off the global. Have I mis-understood or am I using incorrectly?
cheers
Dave