The CreatorCon Call for Content is officially open! Get started here.

Call Script Include from UI Page

hloredo
Kilo Explorer

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.

4 REPLIES 4

Ivan Martez
ServiceNow Employee
ServiceNow Employee

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/


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


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/


Thank you very much, using the GlideAjax object works perfectly.

Cheers