REST API Integration not working while using the PUT method to update incident on another SNOW instance

suhan07
Kilo Contributor

Hi, 

I am new to REST API Integration, still exploring the ServiceNow learning curve. I am trying to implement an eBonding integration between two SN instances - SN1 (source) and SN2 (target). 

I am able to successfully create the incident. However, when I am trying to update the incident using the "PUT" method, any update in SN1 is not being reflected in SN2. For your reference, I am providing the BR below, would really appreciate some help here?

(function executeRule(current, previous /*null when async*/) {

// Add your code here

var body = {
"short_description": current.short_description.toString(),
"description": current.description.toString(),
"caller_id": current.getDisplayValue('caller_id'),
"state": current.getDisplayValue('state'),
"impact": current.getDisplayValue('impact'),
"urgency": current.getDisplayValue('urgency')
};

var corID = current.getValue('correlation_id');

try {
var r = new sn_ws.RESTMessageV2('TDC Integration', 'Default PUT');
r.setEndpoint('https://dev100277.service-now.com/api/now/table/incident/'+corID);
r.setRequestBody(JSON.stringify(body));

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

//set a MID server name if one wants to run the message on MID
//r.setMIDServer('MY_MID_SERVER');

//if the message is configured to communicate through ECC queue, either
//by setting a MID server or calling executeAsync, one needs to set skip_sensor
//to true. Otherwise, one may get an intermittent error that the response body is null
//r.setEccParameter('skip_sensor', true);

var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();

}
catch(ex) {
var message = ex.message;
}
})(current, previous);

   

 

17 REPLIES 17

Actually Chuck I am trying out both the options: (1) ebonding spoke and (2) Outbound REST Message + Business Rule

As part of the ebonding spoke solution, I have created a new Flow (through Action Designer) to update the remote incident in the target instance. 

Would really appreciate some input / guidance here Chuck.

 

A. The Trigger and Action that I have defined 

find_real_file.png

 

find_real_file.png

 

 

B. Below are the errors:

 

find_real_file.png

 

find_real_file.png

 

 Regards,

 

Suhan Dasgupta.

A 403 indicates you may not have permission to update something on the remote system. Have you checked the credentials to ensure they work properly? 

Hi Chuck,

Yes, I have verified the credentials as well as the ACL rules on the field that I am trying to update.

 

Regards,

Suhan Dasgupta.