Update Knowledge Bases from ServiceNow to ServiceNow with Rest Outbound
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 07:30 AM
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:
PATCH METHOD:
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:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 09:43 AM