Request data from another ServiceNow instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 06:26 AM
Hi all
I'm seeking ways to set up 'something' in instance A to request instance B to send data to instance A once per week. The data provided by instance B should go to the transform map in instance A before being populated in instance A.
Could somebody tell me how to go about doing this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 06:45 AM
Hello @tsoct ,
Please refer the below video which will help you.
https://www.youtube.com/watch?v=j3BVJAueXLM
Thanks,
Omkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 06:49 AM
Hello @Omkar Kumbhar ,
The video is about setting the POST/PUT method in the instance which should be providing the data. I am looking for a way for instance that request for data to trigger a request to instance B to provide data. REST should be set up in instance A. Any idea how should I do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 07:11 AM
Hello @tsoct ,
1) Create a rest message in instance A consume the rest message of instance B.
Use the basic authenticate of instance B
later create the POST https method
Create the scheduled job and copy script
Create the stagging table and map the data from response to stagging.
Later stagging table you can map it to target table.
Please try this approach and let me know if this works.
Thanks,
Omkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2023 07:38 AM
Thank you, @Omkar Kumbhar ,
I completed the first step of creating the GET HTTPS in instance A, with the endpoint 'instanceB table API'. And the rest has me confused. Please be patient with me. 🙂
And here are my inquiries:
1) Should the endpoint of the POST https method be instance A's staging table? If no, how both POST and GET relate?
2) Is the scheduled job's script correct?
var org = gs.getProperty('instance_name');
var gn = new GlideRecord('sys_user_has_role');
while(gn.next()){
var body ={
"u_organization": org,
"u_role": gn.role.getDisplayValue(),
"state": gn.allocated_status.toString(),
};
try {
var r = new sn_ws.RESTMessageV2('Integrate instance B', 'Default GET');
r.setRequestBody(JSON.stringify(body));
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
} catch (ex) {
var message = ex.message;
}
}
Thank you