Update Table from REST Message Response

James Connors1
Kilo Explorer

Hello all - 

We are using a REST API - POST message from SN via a business rule to update data in a third-party system (non service-now).

This is functioning via an async BR but looking for the best method for implementing an integration of this type. Any examples of script includes or alternatives are appreciated. We are also capturing the response status in the original table so we can identify issues real-time as close to real-time as possible.

Here's the current code structure for reference.

 

(function executeRule(current, previous /*null when async*/ ) {
try {
var r = new sn_ws.RESTMessageV2('message, method');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var responseObj = JSON.parse(responseBody);

current.status = responseObj.status;
current.update();

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

1 REPLY 1

Kieran Anson
Kilo Patron

If you have an IntegrationHub entitlement, I'd strongly recommend migrating to using it with a simple flow