How to call REST Message from UI Page client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 02:12 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 02:53 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 03:37 AM
Hi Ankur,
Are there any documentations that I can look into? sample code that from GlideAjax calling a REST Message.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 03:53 AM
Hi,
GlideAjax will call script include function
That script include function can have server side code of REST Message
sharing link for help
GlideAjax Tutorial 1: Display 5 Most Recent Incidents in a UI Page
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 04:31 AM
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.