Skip to main content

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:

  1. Approval Request:

    • Automatically send an approval request to the manager of the user who submitted the Telework Case.
  2. 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.

Final result

Your flow will look like this:

caution
  • Your Flow work only exists in your browser until you click the Save button.
  • You are encouraged to click the Save button as frequently as you would like to ensure you don't lose any progress.

Instructions

  1. From the App Home tab, in the "Logic and automation" section, click Add.
  1. Click Flow.
  1. Click Build from scratch to create a new workflow.
  1. Create the flow with the following information:

    FieldValue
    NameTelework Case Approval
    DescriptionApprove and fulfill new Telework Cases.

    Click on the Continue button.

  1. Click the Edit this flow button to begin the configuration process.
  1. You may see a tour popup. Let's skip the tour for now, by clicking the Skip tour button.
  1. Add a trigger to determine when and how the Flow will run.
    1. Click on Add a trigger in the upper left of the flow designer screen.
    2. Select Created from the Record section.
    3. Click the 'Table' drop-down.
    4. Type telework case and click the Telework Case table.
    5. Click Done to close the trigger.
  1. Request an approval from the 'Opened by' user's manager with the 'Ask for Approval' Action.
    1. Click Add an Action, Flow Logic, or Subflow.
    2. Click Action.
    3. Click Ask For Approval. Add the record the manager is approving.
    4. Click on the Data Pill Picker.
    5. Select Trigger – Record Created.
    6. Select Telework Case Record.
info
  • 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.
  1. Configure the Rules for when this record is approved.
    1. Click the '-Choose approval rule' drop-down.
    2. Choose Anyone approves. Next, you need to specify which person the approval will go to.
    3. Click on the Data Pill Picker to look up data on the 'Telework Case' record that triggered this flow.
    4. Click Trigger - Record Created.
    5. Click on the chevron to access the list of fields on the 'Telework Case' record.
    6. Scroll down to locate the Opened by field and click on the chevron next to it.
    7. Scroll down to locate the Manager field and click on it.
    8. Click Done to finish configuring the 'Ask for Approval' Action.
info

Going from Record to Record to Record to find a specific field in ServiceNow is called "Dot-Walking".

  1. Add Flow Logic for If the manager approves...
    1. Under the 'Ask for Approval' Action, click on Add an Action. Flow Logic, or Subflow.
    2. Click Flow Logic.
    3. Click If.
    4. In the Condition Label field type "Manager approves".
    5. Click on the Data Pill Picker next to 'Condition 1'.
    6. Click 1 – Ask for Approval.
    7. Click Approval State.
    8. Click the 'Select a choice' drop-down.
    9. Click 'Approved'.
    10. Click Done.
info

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.

  1. Add the Create a Ticket Action.

    1. Under If Manager approves click ⊕ next to 'then'.
    2. Select Action > ServiceNow Core > Create Task.
    3. For Table, select "Ticket".
    4. Click Add a field value.
    5. Click 'Select a field'.
    6. 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.
    7. Click on the Data Pill Picker.
    8. Select Trigger - Record created > Telework Case Record. Result:
    9. Click + Add field value and add two other fields:
    Field NameField Value
    Short descriptionVPN Access
    Assigned toSystem administrator (Normally you would not specify a user here, but this will make the lab easier.)
    1. If the Field Values look like below, click Done.
    2. Click the Add Annotation button to the right of the Create Task Action.
    3. Type Request VPN Access and press ENTER.
info

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.

  1. Add and configure the 'Send Email' Action.

    1. Click ⊕ under Create Task.

    2. Select Action > ServiceNow Core > Send Email.

    3. Click the Add Annotation button.

    4. Type Notify Opened By in the field and press ENTER. Emails need to be associated to a target record for tracking.

    5. Click the Data Pill Picker next to Target Record.

    6. Select Trigger - Record created > Telework Case Record.

    7. Click the Data Pill Picker next to the To field.

    8. Click Trigger - Record created.

    9. Click the chevron next to 'Telework Case Record'.

    10. Click the chevron next to 'Opened by'.

    11. Click 'Email'.

    12. For the Subject, enter:

      Your Telework application is approved

    Set the Body of the email.

    1. In the Body field, type Dear (Be sure to include the extra space at the end).
    2. Click the Data Pill Picker to the right of the Body field.
    3. Dot-walk to and click the field Trigger - Record Created >> Telework Case Record >> Opened by >> Name.
    info

    If you drop the Data Pill before the word 'Dear ' you can drag and drop it to the correct location.

    RESULT:

    1. In the Body field, press Enter to move to the cursor to the next line.
    2. Type Your application for (Be sure to include the extra space at the end).
    3. Click the Data Pill Picker to the right of the Body field.
    4. Dot-walk to and click the field Trigger - Record Created >> Telework Case Record >> Arrangement >> Code.
    5. Type <space>is approved. after the data pill. (Be sure to include an extra space before the words).
    6. Click Done.
  1. Your flow should look like this:
  1. Click on the Toggle view to visualize the flow as a Diagram.
  1. In the top right corner of the screen, Click Save.
  1. Click Activate on the left of the Save button. This makes the Flow 'live' in the app.
  1. In the Confirmation box click the Activate button.
  1. 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.