- 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-18-2018 05:21 AM
If u_jira_sys_id is a reference field, and jsonObject.summary contains "testing please ignore", you're going to have issues. The reference field expects a sys_id.
Under the assumption that it is a reference field AND there's a table somewhere that has a record with a display value "testing please ignore", then you can set the sys_id on the reference field, effectively "pointing" the reference field to the record with that display value using the setDisplayValue() method.
Ex:
var prbNumber = "PRB0001001";
// Update the problem this incident points to
current.problem.setDisplayValue(prbNumber);
If it's simply a string to hold a guid from another system, that's OK. Please clarify.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 05:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 05:33 AM
Hi Chuck,
Thanks for your response. But here i would like to develop PUT method. And whenever any work notes change in either instance's incident, it will gets passed to other instance's incident.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 05:35 AM
Sounds pretty basic to me. Use the REST API Explorer to build and test your content. When you are ready to tie it to a business rule, click the ServiceNow link to view the code snippet and get started with the code.
Getting Started with REST - ServiceNow Wiki
REST API Explorer - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 06:22 AM
Hi Chuck,
As I was trying to push work notes update from one instance to another by clicking on Update button . Through this UI action, I am calling script action through event queue and below is the code:-
try {
var r = new sn_ws.RESTMessageV2('Test API', 'put');
gs.log('Called till here');
r.setRequestBody("{\"work_notes\":\"This is Test 2\"}");
var response = r.execute();
gs.log('Instance B Update ');
}
catch(ex) {
var message = ex.getMessage();
}
The End point has been setup to the Instance A's API. Which i don't think i would need to define explicitly here. But its just printing the log message however not updating the linked incident in Instance B.
Could you please let me know what I am missing & what needs to correct?
Thanks in advance!!!