
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2019 10:29 PM
Hello,
Is it possible to use, for example XMLHttpRequest API and GET, to retrieve information from external API and show it as VA response.
Thank you!
Solved! Go to Solution.
- Labels:
-
Virtual Agent

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2019 10:29 AM
Hi there,
Sure this is possible.
I did a real quick test, 10 minutes, gave me already Incident details from an other instance.
Just added a Script Action Utility with below code. Most of it just generated thru the API Explorer within ServiceNow.
(function execute() {
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://some-instance.service-now.com/api/now/table/incident/fb1fb9e44f67f300e7fe0ab18110c74f');
request.setHttpMethod('GET');
//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'user';
var password = 'password';
request.setBasicAuth(user,password);
request.setRequestHeader("Accept", "application/json");
var response = request.execute();
vaVars.api = response.getBody();
})()
In the Topic, on a Text Utility just added:
(function execute() {
return vaVars.api;
})()
So yes, very well possible.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 02:50 AM
Thank you, Mark, I tested my solution and it was working just fine, thanks to your clarification.
Regards,
Ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 11:44 AM
Hi,
For cases that API call take longer that 10 seconds for example - is there a way to "wait" for the response and then continue to the next action?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 12:01 PM
Hi there,
See my articles list. 2 weeks ago I published an article on a Topic Block "Wait N Seconds". There's also a Share download.
Community article list
It might not be best practice / recommended by ServiceNow, though there's no suitable other option (and something similar is actually being used in one of the out-of-the-box template topics).
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list