The CreatorCon Call for Content is officially open! Get started here.

We have scripted rest API which gets the request from another API. we have to update this request in a field in a table. I am able to get the request details & i can see the request body by capturing in the logs but when i am trying to set the same b

krishna26
Kilo Expert

Hi Guys,

We have scripted rest API which gets the request from another API. we have to update this request in a field in a table. I am able to get the request details & i can see the request body by capturing in the logs but when i am trying to set the same body to the concerned field in the required table , i couldn't do so, it's empty. (pls see the screen shots for reference).

I need that request body to be updated to the particular field . Any help on this please ?

1 ACCEPTED SOLUTION

as discussed over hangout , we solved it with below line. 

 

var parser = new JSON();
var obj = parser.decode(ab);

 

 

View solution in original post

15 REPLIES 15

Harsh Vardhan
Giga Patron

you have to parse the  json and then set the value to corresponding column on your script. 

 

refer the doc link for further details. 

https://developer.servicenow.com/app.do#!/api_doc?v=london&id=r_JSON-parse_S

Hi Harsh,

Thanks for help but that didn't work instead got this warning

just comment that line 

 

quick question, what are you getting in variable jobID, put the log and share here. 

 

also paste the json log details, if possible. 

Hi I am getting a jobid (like 023016e60b815a9c) i have attached the screen shot of the table where the request body should be updated . I have already attached the log details when i tried to parse the object