Reputation: 3242
Within our ServiceNow installation we have created a simple new Request form with two text input values. The form looks something like this:
+--------------------------------------------------------+
| Get new Computer-request |
+--------------------------------------------------------+
| model: <text input field> |
+--------------------------------------------------------+
| organization: <text input field> |
+--------------------------------------------------------+
When a new request has been created using this form, we can retrieve all relevant information using the ServiceNow table API, by querying the following tables:
When issuing these REST calls we have to use several filters to navigate from one table to another and to only get the most recent items and only the request items within our service catalog category.
Ideally, we would like to save the entire request (timestamp, user, input values) as a JSON String within a single table. This way, we would only have to query this single table to retrieve all relevant information for a request.
Does ServiceNow support generating/saving a single JSON file from request form?
Any help is highly appreciated.
Upvotes: 1
Views: 5679
Reputation: 3242
After some reading about scripted REST Apis as suggested by Joey's answer, I have created some code to do the table joining and filtering on ServiceNow.
The code is here: https://github.com/1123/ServiceNowRequestsApi
Upvotes: 0
Reputation: 2951
If your goal is to be able to make a single request to the instance which gives you all the details of the request (across tables), you may be better off defining a custom Scripted REST api.
You'd write a script to define the JSON response you want, and then just call that API instead of the standard table query APIs.
Upvotes: 3