- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 08:37 AM
Hi All,
In REST integration, we are getting Response.getBody() with lots of fields and values respective to it. However, i would like to get some specific value from that Response.Could anyone please let me know how to get that? I tried with decode and Parse but still in log its displaying undefined.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 09:05 AM
Result does not appear to be an array. I'm reaching this as:
gs.log('Number=' + jsonObject.result.number);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 03:19 AM
Hi ctomasi
I have a very similar issue. I;m sending ticket info to a 3rd party and I get a response of:
{"message":"saved successfully.","ticketId":4920506}
I need the ticketId only to be updated to a field called u_vendor_ref_number
In the business rule I have this at the end of the call to the 3rd party
var response = request.execute();
gs.log('xxx API Status v4: ' +response.getStatusCode());
gs.log('xxx API Response v4: ' +response.getBody()); // this logs returns 'xxx API Response v4: {"message":"saved successfully.","ticketId":4920506}'
So I tried adding like the above example the following
var jsonBody = response.getBody();
var jsonObject = JSON.parse(jsonBody);
gs.log('Number=' + jsonObject.result.ticketId); // this logs returns 'Number=undefined'
How can I get the tickedId reference and add it to the u_vendor_ref_number from the business rule.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 04:38 AM
Hi Dave,
Based on what you've shown, your JSON response doesn't have a 'result' object within it. Try this instead.
var jsonBody = response.getBody();
var jsonObject = JSON.parse(jsonBody);
gs.log('Number=' + jsonObject.ticketId);
More info on this can be found in episode 37 of TechNow where we talked specifically about parsing JSON.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 05:52 AM
Thanks Chuck, that did the trick but now having issue getting that ticketId into my ref field. Had a quick look through the YT video you mentioned but it was all in babackgorund scripts so you didn't seem to touch on doing a current update from a business rule

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 05:55 AM
See my comment on your other thread, Dave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2018 10:04 AM
Hi Chuck/Dave,
I do have same query. Is it not possible to set any field from json object similar to below
var jsonObject = JSON.parse(responseBody);
current.setValue('u_summary', jsonObject.fields.summary);
I'm able to see below in syslog table, but i would like to set this value in to a field in the current record as mentioned above which is not working.
gs.info('Summary='+jsonObject.fields.summary);
Please suggest