- 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
‎04-10-2020 04:10 AM
My response is like this:
{ "deskID":"148" "error":"" }
and I want to retrieve the desk ID, so tried this:
var responseBody1 = response1.getBody();
var jsonObject = JSON.parse(responseBody1);
gs.info('number='+jsonObject.deskID);
But with background script I am not getting any result?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2018 10:05 AM
Hi Dave,
Are you able to set u_vendor_ref_number?
if yes, can you share the steps?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 04:41 AM
Hi. yes this what I am using at the end of my Business Rule:
var jsonBody = response.getBody();
var jsonObject = JSON.parse(jsonBody);
gs.log('Number=' + jsonObject.ticketId); // you'll need to check the jsonBody to see what jsonObject you need to use
current.setValue('u_vendor_ref_number', jsonObject.ticketId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 04:58 AM
I tried the same, But not working for me and really not getting the reason. Below is the info that i could see in syslog
Below is my script
var jsonObject = JSON.parse(responseBody);
gs.info('Summary='+jsonObject.fields.summary);
current.setValue('u_jira_sys_id',jsonObject.fields.summary);
below is the response i received from REST
"fields": {
"summary": testing please ignore,
"resolution": null,
}
Any Suggesion?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 05:07 AM
Are you doing this in a BEFORE or AFTER business rule?
Not to be too picky, but your summary value in the JSON should be enclosed in double quotes (if you have the capability to do so.)