Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to call REST Message from UI Page client script

Enrico Domingo
Kilo Contributor

Hi, I want to call a REST Message which i setup from UI Page that I created.

The reason for this is I want to use sn_auth.GlideOAuthClient() which requesting a token to azure ad.

tried writing a javascript ajax or xhr but i'm having cors error

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

This line seems server side and hence not working -> sn_auth.GlideOAuthClient()

You can do normal GlideAjax from UI page client script.

In that script include function invoke the REST Message

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

Are there any documentations that I can look into? sample code that from GlideAjax calling a REST Message.

 

Thanks!

Hi,

GlideAjax will call script include function

That script include function can have server side code of REST Message

sharing link for help

GlideAjax - Client

GlideAjax Tutorial 1: Display 5 Most Recent Incidents in a UI Page

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Tried following this.

http://aqibnow.com/2014/glide-ajax-1/

but i have my own html template with a button.

that button has onclick, which calls the method that needs to call the REST message, which in this case the script include.

but i can't get any callback.