Bidirectional Integration from 1 service now to another servicenow

ravichanduk
Mega Expert

Hi can anyone help me how to done this integration

Incident created or update in one instance that should be reflect on other snow instance also

messaged should be send for both of them

if anybody done with this please share the code and process

19 REPLIES 19

ravichanduk
Mega Expert

If any body having document regarding bi directional integration or using third party tool integration please share to me it will helpful for me

 

 

Thank in advance

Dhruv Chandan
Giga Guru

Hi All,

 

I've completed this using REST APIs. Same can be done using SOAP too.

 

Thanks.

Dhruv

Hi Dhruv,

I'm working on the similar requirement. Can you share the business rule for update scenario, how are you checking if the incident already exists in another instance?

Rahul Jain11
Kilo Guru

You can use the GlideRemote API to integrate from one servicenow instance to another servicenow instance.

Below is the link for your reference:

http://www.john-james-andersen.com/blog/service-now/remotely-accessing-data-from-another-service-now-instance.html

http://snaug.com/?p=70

 

Thanks

 

LisaKomidar
Giga Guru

I'm trying to do basically the same thing.  This is where I am with proof of concept between my test and production instances.

1 - Created a new variable on each SNow instance called Consumer Record where I want to store the sys_id of the incidents on the opposite system.

2 -  On the production instance, I have the put and patch rest api completed with the variables defined.

3 - On my incident records, I have a business rule for insert to write from production to test via the api. This all works.  I get back my response and the record is on the test instance.  My test instance has the production sys_id in the consumer record field just fine.

However, I'm not sure what I need to do so the test incident sys_id can be stored in the production incident's consumer record. 

 

Here is my business rule:

(function executeRule(current, previous /*null when async*/) {
try {
 var r = new sn_ws.RESTMessageV2('ToTestInstance', 'post');
 r.setStringParameterNoEscape('assigned_to', current.assigned_to);
 r.setStringParameterNoEscape('caller', current.caller);
 r.setStringParameterNoEscape('interpreter', current.u_language_line_interpreter);
 r.setStringParameterNoEscape('vendor_sr', current.u_vendor_service_request);
 r.setStringParameterNoEscape('location', current.location);
 r.setStringParameterNoEscape('short_description', current.short_description);
 r.setStringParameterNoEscape('state', current.incident_state);
 r.setStringParameterNoEscape('close_code', current.close_code);
 r.setStringParameterNoEscape('severity', current.severity);
 r.setStringParameterNoEscape('priority', current.priority);
 r.setStringParameterNoEscape('urgency', current.urgency);
 r.setStringParameterNoEscape('subcategory', current.subcategory);
 r.setStringParameterNoEscape('comments', current.comments_and_work_notes);
 r.setStringParameterNoEscape('impact', current.impact);
 r.setStringParameterNoEscape('close_notes', current.close_notes);
 r.setStringParameterNoEscape('contact_type', current.contact_type);
 r.setStringParameterNoEscape('company', current.company);
 r.setStringParameterNoEscape('category', current.category);
 r.setStringParameterNoEscape('description', current.description);
 r.setStringParameterNoEscape('u_consumer_record', current.sys_id);

//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthentication(authentication type, profile name);

 var response = r.execute();
 var responseBody = response.getBody();
 var httpStatus = response.getStatusCode();
    if(httpStatus == '201'){
        var record = JSON.parse(responseBody);
        current.u_consumer_record = record.sys_id;
        current.update();
    }
}
catch(ex) {
 var message = ex.getMessage();
}

})(current, previous);