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

Create and Update Incident (ServiceNow) - Workflow

  • Dark
    Light
  • PDF

Article summary

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.  In Automation Studio, expand the Workflows section.

Create a Workflow Video - Part 1
 

Step 1

Expand the Workflow Group for Create and Update Incident - ServiceNow

Step 2

This use case will incorporate three Itential Pre-built workflows through the use of Child Job tasks.   Click into the Create Incident - ServiceNow Workflow.

Step 3

In this workflow, you can see various task types.  IAP has four task types: Termination, Automatic, Operational, and Manual.   Let’s define these individually.

  •  Every workflow has Termination tasks to start and end the workflow.  All other tasks are placed between the Start and End termination tasks.
  • The green tasks represent Automatic tasks.   These tasks will execute without intervention.
  • Next are Operational tasks, which are purple.  Operational tasks are used to control workflows with conditional branches and loops, and to manipulate run time data.
  • The fourth task type is Manual tasks.   Manual tasks are grey and represent tasks that require human interaction.  

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 device, while the last takes the results from the Command Template and renders it in a Jinja2 Template for incorporation into our ServiceNow incident.  

Create a Workflow Video - Part 2


Step 9

Now that we’ve gone over the Itential pre-builts, we will continue with our workshop exercise building a workflow that uses the JSON Form and Transformation (JST) you built earlier.
From Automation Studio, select Create a Workflow.  

Step 10

The Create window opens.  Name the workflow Lab – Incident – ServiceNow – XX (XX represents your initials) and click Create.

Step 11

A fresh workflow canvas opens.  For our use-case, we would like to build our workflow horizontally, so we will click and drag the Start and End termination tasks so they are aligned horizontally on our canvas.

Step 12

We are ready to begin adding tasks from our Task Palette. 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.

Add a Transformation task by entering Transformation into the Search box in the Task Palette. The Transformation task appears.  

Step 13

Click and drag the Transformation task onto the canvas and place it to the right of the Start task.

Step 14

Next, you will need to add four Child Job tasks.  Add the first Child Job task to the right of the Transformation task.   Leave space after the first Child Job task and add a second and third Child Job task.  Leave space after the third Child Job task and add the fourth Child Job task. 

Step 15

Finally, you will need to add two Query tasks to the canvas.  Place the first Query task between the first and second Child Job tasks.   Place the second Query task between the third and fourth Child Job tasks.  When complete, your workflow should look like the image shown.

Step 16

The next step is to add transitions which will connect the tasks together to form the workflow.  This is done by first clicking the Start task, which will highlight the task with a dashed border.  Click within the dashed border and begin dragging the transition towards the Transformation task.  When the transition snaps to the Transformation task, release the mouse button.

Step 17

Repeat this process to add transitions between the remaining tasks.

Note:  The default transition is a Success transition.  If you would like to add an Error or Failure transition, press and hold the E or F key on your keyboard as you are adding the transition.  If you would like to change an existing transition, right click on the transition and a popup will open.  From the popup, you can choose to change the transition type or to delete the transition.

Create a Workflow Video - Part 3

Step 18

The next step is to begin configuring the workflow tasks.   Double click the Transformation task to configure it.  

Step 19

Configure the Transformation task by making the following changes:
Enter Lab - Incident - ServiceNow in the Transformation Name field and select the Lab - Incident - ServiceNow - JST – XX Transformation. The summary will automatically update.

Step 20

By changing the Variable Source for formData 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.  Ensure formData is entered in the Job Variable field.

Step 21

Change the Variable Source for user from Static to Job and select initiator for the Job Variable.
Close the Configuration window. 

Step 22

Next, double click the first Child Job task.

Step 23

Update the Summary to Create Incident.

Step 24

Enter Create Incident - ServiceNow in the Workflow search box and select the Create Incident - ServiceNow workflow. Note, this is the first Pre-built we looked at earlier.

Step 25

Make the following changes to the Job Variables: 

  • For summary, select Task as the Variable Source.  
  • Select Lab – Incident – ServiceNow – JST – XX for the Previous Task and incidentSummary for the Task Variable
  • For comments, select Static as the Variable Source and leave the Variable Type and Value blank. 
  • For caller, select Static as the Variable Source.  Select String for the Variable Type and enter Workshop for the Value

Close the Configuration window. 

Step 26 

Double click the first Query Task.

Step 27 

Update the Summary to Query Incident Number.

Step 28

Make the following changes to the Job Variables:  

  • For pass_on_null, select Static as the Variable Source and False for the Value
  • For query, select Static as the Variable Source and enter createdIncident.response.number for the Value
  • For object, select Task as the Variable Source.  Select Create Incident for the Previous Task and job_details for the Task Variable.  

Close the Configuration window.  

Step 29

Double click the second Child Job task. 

Step 30

Update the Summary to Set Incident in Progress.

Step 31

Enter Update Incident - ServiceNow in the Workflow search box and select the Update Incident - ServiceNow workflow. This is the second pre-built workflow we reviewed earlier.

Step 32

Make the following changes to the Job Variables

  • For incNumber, select Task as the Variable Source.  
  • Select Query Incident Number for the Previous Task and return_data for the Task Variable
  • For comments, select Static as the Variable Source and leave the Value blank. 
  • For state, select Static as the Variable Source and enter in progress for the Value.

Close the Configuration window.

Create a Workflow Video - Part 4

Step 33

Double click the third Child Job task.

Step 34

Update the Summary to Run Command and Jinja2 Template.

Step 35

Enter Run Command and Jinja2 Template in the Workflow search box and select the Run Command and Jinja2 Template workflow. This is the third pre-built workflow we reviewed earlier.

Step 36
Make the following changes to the Job Variables: 

  • For device, select Task as the Variable Source.  
  • Select Lab – Incident – ServiceNow – JST – XX for the Previous Task and device for the Task Variable.
  • For command, select Task as the Variable Source.  
  • Select Lab – Incident – ServiceNow – JST – XX for the Previous Task and command for the Task Variable.
  • For templateName, select Static as the Variable Source and enter Format ServiceNow Comment for the Value

Close the Configuration window.
 
Step 37

Double click the second Query Task.

Step 38

Update the Summary to Query ServiceNow Comment.

Step 39

Make the following changes to the Job Variables: 

  • For pass_on_null, select Static as the Variable Source and False for the Value
  • For query, select Static as the Variable Source and enter renderedTemplate for the Value
  • For object, select Task as the Variable Source.  
  • Select Run Command and Jinja2 Template for the Previous Task and job_details for the Task Variable.  

Close the Configuration window. 

Step 40

Double click the fourth Child Job task.

Step 41

Update the Summary to Update Incident.

Step 42
Enter Update Incident in the Workflow search box and select the Update Incident – ServiceNow workflow. This is the original pre-built workflow we reviewed earlier.

Step 43

Make the following changes to the Job Variables: 

  • For incNumber, select Task as the Variable Source.  
  • Select Query Incident Number for the Previous Task and return_data for the Task Variable
  • For comments, select Task as the Variable Source.  
  • Select Query ServiceNow Comment for the Previous Task and return_data for the Task Variable
  • For state, select Static as the Variable Source and leave the Value blank. 

Close the Configuration window.
 
Step 44

Your workflow is now complete.    Click Save.

Step 45

Itential’s workflow canvas allows users to define the logic that matches their business process.  In this use-case example, we’ve used a few of Itential’s pre-built automations to create an incident in ServiceNow, extract the status of the Child Job that created the incident, progress the incident to “in progress”, run a command against a device, capture and format the output, and update the incident with a comment.  This is an example workflow designed to show the flexibility of our platform.

Step 46 

Click Run. The Run Workflow 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 Run button will run the workflow, but we are only testing it to confirm the inputs. Your view should match the image shown.

Click Cancel.

 


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.