Update Knowledge Bases from ServiceNow to ServiceNow with Rest Outbound

Aruna Sree Yela
Tera Guru

Hi, 

 

I was trying to update the Knowledge Base on instance 2 when it gets updated in instance 1.  For this I created a Rest Message with PATCH method. However, that's not updating the record in instance 2. Below are the details.

 

Requirement:

When a KB updated on instance 1 -------> then it should be updated on instance 2

 

REST MESSAGE:

ArunasreeYela_0-1721139066605.png

 

PATCH METHOD:

ArunasreeYela_1-1721139125951.png

 

Business Rule:

 

 

(function executeRule(current, previous /*null when async*/ ) {
    var sysID = current.sys_id;
    gs.addInfoMessage('sys id is ' + sysID); // can see this message with correct sys_id but not updating that record
    try {
        var r = new sn_ws.RESTMessageV2('KBs Integration with instance 2', 'Update KB in instance 2');
        r.setStringParameter('sys_id', sysID);
        r.setStringParameterNoEscape('desc', current.description);

        var response = r.execute();
        var responseBody = response.getBody();
        var httpStatus = response.getStatusCode();
    } catch (ex) {
        var message = ex.message;
    }

})(current, previous);

 

 

 

I tried the same thing for incident table, which is working good. But for knowledge its not. I gave can read and can contribute access to rest_service role as well in instance 2.  As integration is new to me, I could not able to figure out the issue. Any help is much appreciated.

 

Thanks in Advance:)

 

 

1 REPLY 1

Sumanth16
Kilo Patron