- 18 Oct 2024
-
DarkLight
-
PDF
Create and Update Incident (ServiceNow) - JSON Forms
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
Next, we’ll build our JSON Form. This form is how users will submit the information needed when running our Update Change Request automation.
JSON Form Video
Step 1
From the Itential Automation Platform dashboard, click Automation Studio in the left navigation panel.
Step 2
Click the + at the top of the left navigation panel.
Step 3
The Create window opens. Click the dropdown menu and select JSON Form in the What would you like to create field.
Step 4
Enter the name Lab - Incident - ServiceNow - XX where XX represents your initials. Click CREATE to create the form.
Step 5
JSON Forms also utilizes a drag and drop interface. By clicking the Form Elements found on the right panel, you can select which types of fields appear in the form. There are six types of form fields or elements to choose from. The first element we need is a Device Dropdown. Click and drag the Dropdown form element to the form canvas where we can see the text Drop elements here.
Step 6
When the element reaches the canvas, a red box will appear indicating where the element will be placed.
Step 7
Once the element has been added to the form, an ellipses icon will appear in the top-right corner. Hover the mouse over the ellipses to see the gear icon.
Step 8
Click the gear icon to configure the form element.
Step 9
The Configure window opens. The Dropdown field will be for selecting a device. For Label, enter Device.
Next, let’s make this a required field. Click the Yes radio button.
For the Placeholder, enter Select a Device.
The Dropdown element requires options as part of its configuration. Select the + Options button in the lower right.
Step 10
Click the Dynamic radio button.
Step 11
Here we will configure the API call used to populate our Dropdown field. First, select POST as the request method.
Next, select the Base URL. For this exercise, we will be making a call to Configuration Manager within IAP, so select /configuration_manager.
Then, for the API Route, select /devices.
Finally, copy the JSON data below and paste it in the Request Body field.
JSON{ "options": { "start": 0, "limit": 200, "sort": [ { "name": 1 } ], "order": "ascending", "filter": { "name": "OS" } } }
Step 12
Click on Make API Call. This will send the API request as you defined in the step above. Notice that the API response is now shown in the Response Body field.
Step 13
Now we will need to choose which data point we want to use for our values. First, we need to select which property contains our list of devices.
Select /list as the Source Property and /name as the Property Key, then click the Query Data button.
Step 14
Select Query Data
Step 15
The dynamic dropdown values are shown. Click the Back button.
Step 16
Click Save.
Step 17
Add a second Dropdown. Configure the fields with the following information:
- Label: Command
- Required: Yes
- Placeholder: Select a Command to Run
The Dropdown element requires options as part of its configuration. Select the + Options button in the lower right.
Step 18
Select Static and then click the + Options button, three times. Add the following static options:
- Static Options:
- show ip interface brief
- show running-config
- show arp
Click Back, then Save.
Step 19
Verify your JSON Form looks like the image below.
We know that users will be submitting data using our form, but when doing that the values are not sent to the workflow individually as our workflow currently expects; they are sent in as a single variable called formData. To handle this, we will need to transform the data. To do that, we’ll build a Transformation.