Call Script Include from UI Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2011 04:48 AM
I've read on the wiki that you can call Script Includes from the HTML section of an UI page.
http://wiki.service-now.com/index.php?title=UI_Pages
But when I try the following script:
-- begin of script--
gs.include("MyInclude");
var foo = new MyInclude();
document.write (foo.myFunction());
-- end of script--
I get an error calling the GlideSystem object.
I'm trying to perform a database query and present the results to the user within a UI Page, how can I make this run?
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2011 05:18 AM
This should help you along. The Service now guru site has great information, you should definitely book mark it!
http://www.servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2011 07:00 AM
Thanks for the link but I had already checked it and it makes no reference about how to call a server-side script from UI Pages.
Regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2011 07:23 AM
While you can call script includes from the HTML in a UI page, it's not a direct call. In order to call a script include you need to use 'GlideAjax' from a client script (which can be called from the HTML).
Here's some information on GlideAjax...
http://wiki.service-now.com/index.php?title=GlideAjax
And here's an example of how you can use it from a UI page...
http://www.servicenowguru.com/system-ui/ui-actions-system-ui/creating-custom-slushbucket-popup-dialog/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2011 09:46 AM
Thank you very much, using the GlideAjax object works perfectly.
Cheers