How to update record with REST API using correlation id?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 07:31 AM - edited 02-14-2023 07:32 AM
Hi All,
I have set up ebonding between two instances and populating the incident number in the correlation ID field on POST. I am having difficulties with PUT as I am not sure how to update with the correlation id being incident number. Can anyone please help me to figure out the right endpoint URL?
Thanks
My set up:
After BR on Incident table on update:
(function executeRule(current, previous /*null when async*/ ) {
var body = {
"short_description": current.short_description,
"state": current.getValue('state'),
"work_notes": current.work_notes.getJournalEntry(1).toString(),
"hold_reason": current.getValue('hold_reason'),
"comments": current.comments.getJournalEntry(1)
};
try {
var r = new sn_ws.RESTMessageV2('Incident Demo Create', 'Update Incident');
var cor = current.getValue('correlation_id');
r.setEndpoint('https://myinstance.service-now.com/api/now/table/incident/' + cor);
r.setRequestBody(JSON.stringify(body));
var response = r.execute();
var req = r.getRequestBody();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
} catch (ex) {
var message = ex.message;
}
PUT endpoint is as below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 07:47 PM
@Ankur Bawiskar @Ashutosh Munot1
Can the experts please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 09:25 PM
Can any experts please help..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 01:02 PM
You can use the API explorer. I linked a generic link in my post where I talk about using it. Just replace my instance with your instance. https://www.servicenow.com/community/developer-forum/api-explorer-is-not-updating-correlation-id-pro...