Create and Update Incident (ServiceNow) - Transformations
  • 18 Oct 2024
  • Dark
    Light
  • PDF

Create and Update Incident (ServiceNow) - Transformations

  • Dark
    Light
  • PDF

Article summary

Next, we will build a Transformation that takes the data from the JSON Form and breaks it out into the individual variables that the Child Job needs in the workflow.

Transformation Video

Step 1

From Automation Studio, click the + at the top of the left navigation panel.

Step 2

The Create window opens.  Click the drop down and select Transformation.

Step 3

Enter the name Lab – Incident – ServiceNow - JST – XX  (XX represents your initials) and click Create.

Step 4

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 trash can icon that displays.  If you would like to add space to the canvas, place your cursor near the top of the canvas and click the + icon that appears.  

Step 5

As you can see, we have an Incoming Schema and an Outgoing Schema.  These schemas will define how data will look before and after it is manipulated.  Let’s start by creating our Incoming Schema.  Click the Add+ button under Incoming Schema and select Incoming Schema.
 
Step 6

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. IAP will digest the sample JSON data, determine the appropriate data types and create a JSON Schema for it.

Step 7

We need to give this schema an ID for reference. In line 2 in the “$id” field, enter formData between the double quotes.  Click Save. The Incoming Schema is created.

Step 8

Click the Add+ button and select Incoming Schema to add a second Incoming Schema

Step 9

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. 

Step 10

Now that you have created the 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 drag a line towards Add+ under Outgoing Schemas.  From the Add+ menu, select Outgoing Schema.

Step 11

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 12

Click Add+ and select Outgoing Schema to add a third Outgoing Schema.

Step 13

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.

Step 14

Before connecting the user Incoming Schema to the incidentSummary Outgoing Schema, we need to transform the data using a Method.  Methods are low-code drag-and-drop representations of JavaScript methods.   In the search box above Methods, enter concat

Step 15

Drag the string concat method to the canvas and position it next to the user Incoming Schema.  For information about a Method, click the i icon next to the Method name to open the JavaScript documentation. Here you will find a description of the method, as well as its parameters and example configurations.  

Step 16

Configure the concat method with the following:
str: Test incident created for:
str2: Map the value from the user Incoming Schema.
Return: Map the value to the incidentSummary Outgoing Schema.
Click the Save icon in the canvas tool bar.
 
Step 17

The Transformation is complete.   To preview the format of the outgoing data, click the Run button.  

Step 18 

The Run Transformation window opens and the device and command inputs are populated with the example formData inputs, we just need to add an example user.  Replace the null value with any sample user and click Run.

Step 19

The Output will display at the bottom of the screen.  Review the output and click Next when you are ready to proceed.

 


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.