- 18 Oct 2024
-
DarkLight
-
PDF
Create and Update Incident (ServiceNow) - Transformations
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
Before we begin building our Transformation, we first need to collect some data.
Transformation Video
Step 1
Open the JSON Form you just created, Lab - Incident – ServiceNow – XX” (XX represents your initials). Click the eye icon in the upper right, and populate the fields in the Preview Form using the drop downs.
Step 2
Click the Show Form Data button at the bottom left.
Step 3
Hover your cursor next to the “2 items” text, click on the clipboard icon to copy the data to Clipboard/Text Editor. Then click Close to close the Preview Form.
This is the format in which the data will be submitted when executing our automation from Operations Manager. You will now build a Transformation that takes the data in this format and breaks it out into the individual variables that the Child Job needs in the workflow.
Step 4
Click the + at the top of the left navigation panel.
Step 5
The Create window opens. Click the drop down and select Transformation.
Step 6
Enter a name of Lab – Incident – ServiceNow - JST - XX where XX represents your initials. Click CREATE to create the form.
Step 7
Note: The canvas loads with a lot of empty space in the center. To remove some of the white space, place your cursor near the top of the canvas, and click the delete (trash can) icon that displays.
Step 8
Click the Add+ button under Incoming Schema. And Select Incoming Schema.
Step 9
Paste the example data from your JSON Form into the field on the right. Then click the Infer Schema From Example JSON button on the left.
In line 2 in the “$id” field, enter formData between the double quotes. Click Save at the bottom.
Step 10
Click the Add+ button under Incoming Schema to add a second schema.
Step 11
In line 2 in the “$id” field, enter user between the double quotes. In line 3 in the "type" field, enter string between the double quotes.
Click Save at the bottom.
Step 12
Now that you have created an Incoming Schemas, you will need to take the data and break it out into the individual variables that the workflow needs. To do that, click the half-circle for the device value in the Incoming Schema and then click the Add + under Outgoing Schemas.
Step 13
The Outgoing Schema is created, building a connection between it and the Incoming Schema. Perform the same steps for the command value in the Incoming Schema.
Step 14
Click the Add + under Outgoing Schemas to add a second Outgoing Schema.
Step 15
In line 2 in the “$id” field, enter incidentSummary between the double quotes. In line 3 in the "type" field, enter string between the double quotes.
Click Save at the bottom.
Step 16
In the search box above Methods, enter concat.
Step 17
Drag the string concat to the canvas and position next to the user Incoming Schema.
Step 18
Configure the concat method with the following:
- str: Test incident created for
- str2: Map the value from user Incoming Schema.
- Return: Map the value to the incidentSummary Outgoing Schema.
Click the Save icon in the canvas tool bar.