- 18 Oct 2024
-
DarkLight
-
PDF
Create and Update Incident (ServiceNow) - Workflow
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
Let’s move into the Incident Create and Update use case. We will begin by reviewing the Itential Pre-Builts that we are using for today’s Workshop.
Create a Workflow Video - Part 1
Step 1
Go to Automation Studio and expand the Workflows drop down.
Step 2
Expand the Workflow Group for Create and Update Incident - ServiceNow.
Step 3
This use case will incorporate three Itential Pre-built workflows through the use of Childjob tasks. Click into the Create Incident - ServiceNow Workflow.
Step 4
The Create Incident - ServiceNow Pre-built workflow utilizes the Itential ServiceNow Adapter. There is one main task, Create Incident. This task reaches out to ServiceNow and creates a new Incident.
Step 5
Next, click into the Update Incident - ServiceNow Workflow.
Step 6
The Update Incident-ServiceNow Pre-built workflow also utilizes the Itential ServiceNow Adapter. There are two main tasks, Get Incident and Update Incident. The Get Incident task reaches out to ServiceNow to obtain the incident's specific information while the Update Incident provides an incident update back to ServiceNow .
Step 7
Finally, click into the Run Command and Jinja2 Template Itential Pre-built Workflow.
Step 8
The Run Command and Jinja2 Template Itential Pre-built Workflow has three primary tasks. The first creates a device array, the second executes a Command Template against the array, while the last takes the results from the command template and renders it in a Jinja2 template for incorporation into our ServiceNow incident.
Step 9
Now that we’ve gone over the Itential Pre-builts, we’ll continue with our workshop exercise building a workflow that uses the JSON Form and Transformation (JST) you built earlier.
Click the + at the top of the left navigation panel.
Step 10
The Create window opens. Click the drop down and select Workflow.
Step 11
Create a New Workflow Named Lab - Incident - ServiceNow - XX. (XX represents your initial)
Step 12
A fresh workflow canvas opens. For this workflow you will first add all of the tasks to the canvas, then connect them with transitions. Finally you will configure each task.
A fresh workflow canvas opens. Add a Transformation task by entering Transformation into the Search box at the top right. The JSON Transformation task appears. Hover the mouse over the task.
A + will appear to the left of the task. Click the + to add the task to the canvas.
Step 13
Click the JSON Transformation task and drag on the canvas just to the right of the Start task.
Step 14
Next, you will need to add four Childjob tasks by entering child job into the Search box at the top right. The Childjob task appears. Hover the mouse over the task.
A + will appear to the left of the task. Click the + four times to add the tasks to the canvas.
Step 15
You will need to adjust the placement of the Childjob tasks on the canvas. Click on each Childjob task and drag it to the positions shown in the image below.
Step 16
Finally, you will need to add two Query tasks to the canvas. Enter query into the Search box at the top right. The Query task appears. Hover the mouse over the task.
A + will appear to the left of the task. Click the + twice to add the tasks to the canvas.
Step 17
You will need to adjust the placement of the Query tasks on the canvas. Place the first Query task between the first and second Childjob tasks. Place the second Query task between the third and fourth Childjob tasks. When complete, your workflow should look like the image below.
Step 18
The next step is to add transitions which will connect the tasks together to form the workflow. This is done by clicking the crossed arrows button at the top of the canvas, then click and drag from the center of the START task to the center of the first JSON Transformation task.
Step 19
Add additional transitions between each task.
Create a Workflow Video - Part 2
Step 20
The next step is to begin configuring the workflow tasks. Double click the first JSON Transformation task to configure it.
Step 21
Configure the Transformation task by making the following changes:
- Enter Lab - Incident - ServiceNow in the in the Transformation Name field and select the Lab - Incident - ServiceNow - JST - XX (XX represents your initials).
By changing the Location for formData under Incoming Schema from static to job, we are configuring the Transformation task to source the data from the form inputs submitted to the workflow, rather than static inputs.
- Change location for formData under Incoming Schema from static to Job. Ensure formData is selected in the Value field.
- Change location for user under Incoming Schema from static to Job. Ensure initiator is selected in the Value field.
Click Save.
Step 22
Next, double click the first Childjob task.
Step 23
Update the Summary to Create Incident. Update the Description to Create Incident using Itential Pre-built.
Enter Create Incident - ServiceNow in the Workflow search box, select the Create Incident - ServiceNow workflow. Note, this is the first Pre-built we looked at earlier.
Make the following changes to Job Variables:
Name | Location | Value |
summary | Lab - Incident - ServiceNow JST - XX | incidentSummary |
comments | static | |
caller | static | Workshop |
Click Save.
Step 24
Double click the first Query Task.
Step 25
Update Summary and Description to Query Incident Number.
Make the following changes to Incoming:
Variable | Reference task | Reference variable |
pass_on_null | static | False |
query | static | createIncident.response.number |
obj | Create Incident | job_details |
Click Save.
Step 26
Double click the second Childjob task.
Step 27
Update Summary to Set Incident in Progress. Update Description to Set Incident in Progress using Itential Pre-built. Enter Update Incident - ServiceNow" in the Workflow search box, select the Update Incident - ServiceNow workflow. This is the second Pre-built workflow we reviewed earlier.
Make the following changes to Job Variables:
Name | Location | Value |
incNumber | Query Incident Number | return_data |
comments | static | |
state | static | in progress |
Click Save.
Step 28
Double click the third Childjob task.
Step 29
Update the Summary to Run Command and Jinja2 Template. Update the Description to Run Command and Jinja2 Template using Itential Pre-built.
Enter Run Command and Jinja2 Template in the Workflow search box, select the Run Command and Jinja2 Template workflow. This is the third Pre-built workflow we reviewed earlier.
Make the following changes to Job Variables:
Name | Location | Value |
device | Lab - Create and Update Incident - ServiceNow - XX | device |
command | Lab - Create and Update Incident - ServiceNow - XX | command |
templateName | static | Format ServiceNow Comment |
Click Save.
Step 30
Double click the second Query Task.
Step 31
Update the Summary and Description to Query ServiceNow Comment.
Make the following changes to Incoming:
Variable | Reference task | Reference variable |
pass_on_null | static | false |
query | static | renderedTemplate |
obj | Run Command and Jinja2 Template | job_details |
Click Save.
Step 32
Double click the fourth Childjob task.
Step 33
Update the Summary to Update Incident. Update the Description to Update Incident using Itential Pre-built. Enter Update Incident in the Workflow search box and select Update Incident - ServiceNow. This is the original Pre-built workflow we reviewed early.
Make the following changes to Job Variables:
Name | Location | Value |
incNumber | Query Incident Number | return_data |
comments | Query ServiceNow Comment | return_data |
state | static |
Click Save.
Step 34
Your workflow is now complete. Click the SAVE icon followed by the ▶ icon.
Step 35
In the Job Description window, click START.
Step 36
The Set Variables window opens, showing the variables the workflow requires to run. This workflow expects to receive one variable, formData, which will be passed in from Operations Manager, which will be covered in the next module.
The START button will run the workflow, but we are only testing it to confirm the inputs. Your view should match the image below.