- 18 Oct 2024
-
DarkLight
-
PDF
Create and Update Change Request (ServiceNow) - JSON Form
- 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.
Create a JSON Form Video - Part 1
Step 1
From the IAP Home page, Click Automation Studio.
Step 2
Click the + at the top of the left navigation panel.
Step 3
The Create window opens. Click the drop down and select JSON Form.
Step 4
Enter a name of Lab – Create and Update Change Request – ServiceNow - XX (where XX represents your initials).
Click CREATE to create the form.
Step 5
We use a drag and drop concept within JSON Forms. By clicking the Form Elements found on the right panel, you can select which types of fields appear in the form. There are seven types of form fields or elements to choose from.
We will drag several Form Elements to the area marked Drop elements here.
Click and drag the Text Input form element to the form canvas.
Step 6
When the element reaches the canvas, a red box will appear indicating where the element will be placed. Place the Text element on the canvas.
Step 7
Next, we need to configure the text field. Hover the mouse over the ellipses located in the upper-right corner.
Step 8
A gear icon appears. Click the gear.
Step 9
The Configure window opens. For Label, enter Title.
Next, let’s make this a required field. Click the Yes radio button.
For the Placeholder, type Enter CR Title.
Click Save.
Step 10
Next, add a second Text Input. Drag the Text Input element to the canvas.
Step 11
Hover your mouse over the ellipses and click the gear icon.
Step 12
The Configure window opens. For Label, enter Summary. Make this a required field by clicking the Yes radio button.
For the Placeholder, type Enter CR Summary.
Click Save.
Step 13
Next, add a third Text Input. Drag the Text Input element to the canvas.
Step 14
Hover your mouse over the ellipses and click the gear icon.
Step 15
The Configure window opens. For Label, enter Description. Make this a required field by clicking the Yes radio button.
For the Placeholder, type Enter CR Description.
Click Save.
Create a JSON Form Video - Part 2
Step 16
Next, you will need a Dropdown. Drag the Dropdown element to the canvas and open the configuration window.
Step 17
Label the field Configuration Item and make it required. For the Placeholder, type Select a Configuration Item.
The Dropdown element requires options as part of its configuration. Select the + Options button.
Step 18
Configure Options window opens, select Dynamic.
Step 19
In the Request Configuration section, select Post for Method. Select /ServiceNow for Base URL and select /getConfigitems for the API Route.
Step 20
Copy the request body below and paste into the configuration field.
{
"sysparmQuery": {
"sysparm_limit": 10,
"sys_class_name": "cmdb_ci_ip_router",
"sysparm_fields": "sys_id,name"
}
}
Then click the Make API Call Button.
Step 21
In the Data Mapping section, select /response for Source Property and select /name for Property Key.
Click Back. Then Click Save.
Step 22
Your form is now complete. 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.