- 18 Oct 2024
-
DarkLight
-
PDF
Security Rule Creation (Panorama) - Transformation
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
Many of the technologies that the Platform communicates with do so through APIs and JSON schema. Often times, when we reach out to a system to retrieve information, more data is returned than perhaps we need or it is in a format that we need to modify. Rather than creating a function that would modify the data for us, we can use our low-code data manipulation tool, JSON Schema Transformation or Transformation, to modify the data so that we can feed it back into our workflow.
For our next activity, let’s create a new Transformation.
Transformation Video (Part 1)
Step 1
From the Itential Automation Platform dashboard, click Automation Studio in the left navigation panel.
Step 2
Click the + icon. The Create window opens.
Step 3
Select Transformation in the What would you like to create dropdown. Type Transformation - Panorama - XX in the Name field. Click the CREATE button.
Step 4
The canvas loads with a lot of empty space in the center. If you would like to remove some extra space from your canvas, you can do so by hovering your cursor near the top of the canvas, and select the delete (trash can) icon. You can also add space to your canvas by hovering your cursor near the top of the canvas and selecting the + icon. To zoom in or out on your canvas, use the canvas controls in the top right corner of the canvas.
Step 5
As you can see, we have an Incoming Schema and an Outgoing Schema. This describes how data will look before and after it is manipulated. Many times, you will receive data from a system and that will define your incoming schema. Our outgoing schema will be what we need the data to look like in order to feed it back into your workflow. Let’s start by creating a few incoming variables.
Step 6
Hover your cursor over the Add + button, and select Incoming Schema from the list that appears.
Step 7
The Add Incoming Schema window opens.
Step 8
Type firstName between the "" on line 2 to add the required ID property.
Step 9
Type string between the double quotes on line 3 to add the required type property. Click the Save button.
Step 10
The first schema is created. Next, hover your cursor over the firstName Incoming Schema and click the clone icon.
Step 11
A copy of the first schema is created. Hover your cursor over the second schema and click the edit icon.
Step 12
Edit the name in line 2 to read “lastName”. Click the save button
Step 13
The second incoming schema is created.
Transformation Video (Part 2)
Step 14
Repeat the process to add one more incoming schema, and two outgoing schema using the data specified below:
Incoming schema
- ID: numberOfPets
- type: number
Outgoing schema
- ID: email
- type: string
- ID: petStatus
- type: string
Step 15
Transformations offer a number of built-in Methods that will manipulate data to fit the needs of the outgoing schema. These Methods do any number of actions from converting data types to creating conditions for the way the data is manipulated. In our exercise today we will use a few of these Methods to better understand their purpose.
Type concat in the Search field to find the method. The list will filter as you type.
Step 16
Drag the concat string method to the canvas. Concatenation is a method used for combining data. In this case, we'll combine first name input, last name input with a domain to create an email address.
Note: For additional information about a method, click the i icon next to the method name.
Step 17
Click the half-circle to the right of firstName string in the list. Drag a line to the half-circle for the first str (string) parameter in the concat method.
Step 18
Type a . (period) in the str2 field. Connect lastName to the strN property.
Step 19
Type @domain.com in the strN field.
Step 20
Connect the return of the concat method to the email outgoing schema.
Step 21
Add an add (+) method to the canvas. Connect the return of the numberOfPets to the first numN property. Type 1 in the second numN field.
Step 22
Add a greatThan (>) method to the canvas. Connect the return of the add (+) method to the a parameter of the greatThan (>) method. Type 5 in the b parameter field of the greatThan (>) method.
Step 23
Add a ternary method to the canvas. Connect the return of the greaterThan(>) method with the condition field of the ternary method. Connect the return of the ternary method with the petStatus outgoing schema.
Step 24
Type That’s a lot of animals! in the exprIfTrue (expression if true) field. Type You need another pet! in the exprIfFalse (expression if false) field. Click the Save icon.
Step 25
Click the ▶ icon.
Step 26
Replace the null values with the following data:
- firstName: “First”
- lastName: “Last”
- numberOfPets: 3
Step 27
Click the Run button.
Step 28
Review the output. When you are finished, close the JST Designer tab in your browser to return to the Automation Studio view.