- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 01:23 PM
Hello all,
I'm working on a system integration with a third party. I have created a web service and transform map in our DEV instance, and we're able to receive and process inbound POSTs with bodies like this:
{
"u_number":"INC7654521",
"u_location":"HQ",
"u_cmdb_ci":"Toaster"
}
However, the third party would like to standardise their outbound messages to have bodies like this:
{
"incident":{
"u_number":"INC7654521",
"u_location":"HQ",
"u_cmdb_ci":"Toaster"
}
}
So, the JSON in my first example itself becomes the value of a field called "incident" in my second example. This doesn't work for the web service I've created, which has field names 'u_number', 'u_location, and 'u_cmdb_ci', and I guess in the second example the message is 'looking for' a field named 'incident'.
What are my options for processing the inbound message in the second case? I'm thinking I may have to write a script to place each inner field value onto the input row to trigger the transform map, but I would like to know what ya'll think.
Jamie.
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 11:17 AM
You can construct the response body in the Scripted rest api script as below
var body = {}; body.name = "incident"; body.number = "1234"; body.caller = {"id": "user1"}; response.setBody(body);
reference: https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_re...
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 01:41 PM
If you are storing the 3rd party ticket number in the incident record, you can query by the 3rd party reference number and send it back in response
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 04:06 PM
Thank you. That worked. My concern was that the Glide lookup would be trying to find the new record before it had been created, but I guess it's the case that all activities associated with the import set table and transform map are completed before the script moves on to the next line - ie it's synchronous.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 04:36 PM
Great. Can you mark it answered so that it will be helpful for others in future.
Please mark this response as correct or helpful if it assisted you with your question.