"Exception while reading request","detail":"The payload is not valid JSON."},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2021 04:16 AM
I am working on Post REST Integration for Incident table and written below Business Rule but while i am checking the logs its showing error.
Please help to fix the error.
***********************************************************************************************************************************
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://dev64283.service-now.com/api/now/table/incident');
request.setHttpMethod('POST');
//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'Integration_user';
var password = 'test@1234';
request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");
request.setRequestHeader('Content-Type','application/json');
request.setRequestBody("{\"short_description\":\"" + current.short_description + "\"\"caller_id\":\"" + current.caller_id + "\"\"priority\":\""+current.priority + "\"\"category\":\""+ current.category
+"\" }");
var response = request.execute();
current.work_notes = response.getBody();
current.update();
//gs.log(response.getBody());
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2021 04:29 AM
Try it with moving the payload away:
var payload = {"short_description": current.short_description ,"caller_id": current.caller_id ,"priority":current.priority ,"category": current.category };
request.setRequestBody(JSON.stringify(payload));
P.S. You forgot the commas in your object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2021 05:43 AM
this is not returning the required field values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2021 05:44 AM
if i am adding commas on the required places its still not working.
below is the error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2021 05:49 AM
Have you tested with moving it away ?
var payload = {"short_description": current.short_description ,"caller_id": current.caller_id ,"priority":current.priority ,"category": current.category };
request.setRequestBody(JSON.stringify(payload));