3.1 Create the Flow
Overview
A flow represents a sequence of steps that are automated to accomplish a specific business outcome. Each flow can include these components:
- Trigger: The event or condition that, when met, automatically initiates a flow.
- Conditions: Allows to provide conditions under which the flow will execute. For example, run the flow only if a field is over a certain value.
- Actions: The tasks performed by the Flow, such as updating data, requesting approvals, or sending notifications.
Objective: Telework Request Approval Flow
The objective here is to design a workflow that automates the telework request approval process.
Flow Overview
- The flow needs to start as soon as a new telework request is created.
- The first thing the workflow needs to do is to reach out to the manager of the person asking to work from home, requesting their approval.
- Once we have the manager's approval, the workflow then proceeds to two critical steps.
- First, it automatically generates a ticket for our IT department for setting up VPN access for the employee.
- Then, we need to notify by email the employee who requested to work from home, informing them that their request has been approved.
Flow Configuration Overview
Trigger:
- The workflow begins when a new Telework Case record is created.
Process:
Approval Request:
- Automatically send an approval request to the manager of the user who submitted the Telework Case.
Upon Manager's Approval:
- IT Ticket Creation:
- Generate a ticket for the IT department to set up remote VPN access for the requester.
- Approval Notification:
- Email the requester to inform them that their telework request has been approved.
- IT Ticket Creation:
Final result
Your flow will look like this:
- Your Flow work only exists in your browser until you click the button.
- You are encouraged to click the button as frequently as you would like to ensure you don't lose any progress.
Instructions
- From the App Home tab, in the "Logic and automation" section, click Add.
- Click Flow.
- Click Build from scratch to create a new workflow.
Create the flow with the following information:
Field Value Name Telework Case Approval Description Approve and fulfill new Telework Cases. Click on the
button.
- Click the Edit this flow button to begin the configuration process.
- You may see a tour popup. Let's skip the tour for now, by clicking the Skip tour button.
- Add a trigger to determine when and how the Flow will run.
- Click on Add a trigger in the upper left of the flow designer screen.
- Select Created from the Record section.
- Click the 'Table' drop-down.
- Type
telework case
and click the Telework Case table. - Click to close the trigger.
- Request an approval from the 'Opened by' user's manager with the 'Ask for Approval' Action.
- Click Add an Action, Flow Logic, or Subflow.
- Click Action.
- Click Ask For Approval. Add the record the manager is approving.
- Click on the Data Pill Picker.
- Select Trigger – Record Created.
- Select Telework Case Record.
- Did you noticed that the Approval Field and Journal Field automatically populated?
- This is because these fields already existed on the Task table that we extended Telework Case from.
- REMEMBER:
- If you're tracking any kind of work (tickets, requests, etc.) it's always a good idea to extend from Task unless you have a good reason not to.
- Configure the Rules for when this record is approved.
- Click the '-Choose approval rule' drop-down.
- Choose Anyone approves. Next, you need to specify which person the approval will go to.
- Click on the Data Pill Picker to look up data on the 'Telework Case' record that triggered this flow.
- Click Trigger - Record Created.
- Click on the chevron to access the list of fields on the 'Telework Case' record.
- Scroll down to locate the Opened by field and click on the chevron next to it.
- Scroll down to locate the Manager field and click on it.
- Click to finish configuring the 'Ask for Approval' Action.
Going from Record to Record to Record to find a specific field in ServiceNow is called "Dot-Walking".
- Add Flow Logic for If the manager approves...
- Under the 'Ask for Approval' Action, click on Add an Action. Flow Logic, or Subflow.
- Click Flow Logic.
- Click If.
- In the Condition Label field type "Manager approves".
- Click on the Data Pill Picker next to 'Condition 1'.
- Click 1 – Ask for Approval.
- Click Approval State.
- Click the 'Select a choice' drop-down.
- Click 'Approved'.
- Click .
Adding the Condition Label of 'Manager Approves' was like adding a comment to our code. This will make any troubleshooting easier later as you can see what the Flow Logic does without opening it up.
Next, if the manager approves, a task should be submitted to IT to configure VPN access for the person.
Add the Create a Ticket Action.
- Under If Manager approves click ⊕ next to 'then'.
- Select Action > ServiceNow Core > Create Task.
- For Table, select "Ticket".
- Click Add a field value.
- Click 'Select a field'.
- Search for 'Parent' in the drop-down and click it. Set the 'Parent' field on the new 'Ticket' record to be the 'Telework Case' record that triggered this Flow.
- Click on the Data Pill Picker.
- Select Trigger - Record created > Telework Case Record. Result:
- Click + Add field value and add two other fields:
Field Name Field Value Short description VPN Access Assigned to System administrator (Normally you would not specify a user here, but this will make the lab easier.) - If the Field Values look like below, click .
- Click the Add Annotation button to the right of the Create Task Action.
- Type
Request VPN Access
and press ENTER.
Adding Annotations makes the Flow easier to read.
Send an email to the 'Opened by' user and let them know their Telework Case request has been approved.
Add and configure the 'Send Email' Action.
Click ⊕ under Create Task.
Select Action > ServiceNow Core > Send Email.
Click the Add Annotation button.
Type
Notify Opened By
in the field and press ENTER. Emails need to be associated to a target record for tracking.Click the Data Pill Picker next to Target Record.
Select Trigger - Record created > Telework Case Record.
Click the Data Pill Picker next to the To field.
Click Trigger - Record created.
Click the chevron next to 'Telework Case Record'.
Click the chevron next to 'Opened by'.
Click 'Email'.
For the Subject, enter:
Your Telework application is approved
Set the Body of the email.
- In the Body field, type
Dear
(Be sure to include the extra space at the end). - Click the Data Pill Picker to the right of the Body field.
- Dot-walk to and click the field Trigger - Record Created >> Telework Case Record >> Opened by >> Name.
infoIf you drop the Data Pill before the word 'Dear ' you can drag and drop it to the correct location.
RESULT:
- In the Body field, press Enter to move to the cursor to the next line.
- Type
Your application for
(Be sure to include the extra space at the end). - Click the Data Pill Picker to the right of the Body field.
- Dot-walk to and click the field Trigger - Record Created >> Telework Case Record >> Arrangement >> Code.
- Type
<space>is approved.
after the data pill. (Be sure to include an extra space before the words). - Click .
- Your flow should look like this:
- Click on the Toggle view to visualize the flow as a Diagram.
- In the top right corner of the screen, Click .
- Click on the left of the Save button. This makes the Flow 'live' in the app.
- In the Confirmation box click the button.
- Close the Flow tab in App Engine Studio.
Exercise Recap
You've built a Flow that takes care of managing tasks and communications across multiple departments.
Next, you will test the Flow to see it in action.