Snow to Snow Bidirectional Integration - Emergys
catch (ex) {
var message = ex.message; }
}) (current, previous);
Create New record in Current Instance you will get same incident in another instance
You need to Follow above Steps in Another instance so Instance B also able to Post Data in instance A
We just need to pass sys_id for Instance B to A why ? It will use in PUT method Just add “u_externalsys_id” : current.getValue(‘sys_id’), in body Payload And Create 1 field in Incident Form of Instance A[Target instance] “External_Sys_id” Type :- String, This field store sys_id of instance B[Source instance]
For Processing PUT method first thing we need to keep in mind that we are Performing Updation on Single Record so we need its sys_id to work on. So in Endpoint we are not mentioning sys_id as it will different for every record, hence we are passing sys_id of particular record Dynamically in Business Rule.
For updating data you need to create PUT method in Outbound REST Message In instance A [Source instance] , as we have already created Outbound REST Message for POST, so we just need to add PUT method in HTTP Method.

A] Add Body Structure whatever field we want to update.
B] Create 1 field in Incident Form “External_Sys_id” Type: – String, [ if you have not created in POST B to A ] This field store sys_id of another instance record so we can add this sys_id in our Endpoint, so we can modified that particular record
In Business Rule Script we need to fetch it and add it to Endpoint as we are passing sys_id dynamically var Ex_sys = current.getValue(‘u_externalsys_id’);
C] Then we need to add Script which is taken from Outbound REST Message.
(function executeRule(current, previous /*null when async*/ ) {
var body = {
“short_description”: current.short_description.toString(), “urgency”: current.urgency.toString(), “caller_id”: current.getDisplayValue(‘caller_id’), “impact”: current.getDisplayValue(‘impact’), “state”: current.getDisplayValue(‘state’), “priority”: current.getDisplayValue(‘priority’), “subcategory”: current.getDisplayValue(‘subcategory’), “category”: current.getDisplayValue(‘category’),
};
var Ex_sys = current.getValue(‘u_externalsys_id’);
try { var r = new sn_ws.RESTMessageV2(‘Snow-Bi’, ‘PUT’); r.setEndpoint(‘https://dev62522.service-now.com/api/now/table/incident/’ + Ex_sys); r.setRequestBody(JSON.stringify(body)); var response = r.execute(); var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
} catch (ex) { var message = ex.message; }
})(current, previous);
Save
Now Create 2-3 Record in instance B[Tareget Instance] and Check in you Source instance You will get same Record with External sys_id , so When you will updating Record in Instance A[Source Instance] it will Update in Instance B, through sys_id
https://dxsherpa.com/blogs/snow-to-snow-bidirectional-integration/