Application Automation · Topic 1 of 4

Building and Testing Flows in Workflow Studio

ServiceNow CAD Workflow Studio: flow triggers, actions, flow logic and data pills, subflows, testing a flow and reading execution details to debug it.

  • 5 min
In a nutshell
  • A flow is trigger plus actions and flow logic; a subflow has no trigger and is called by others.
  • Trigger types: record, date (scheduled) and application.
  • Data pills carry outputs from the trigger and earlier steps into later steps.

What it is

Workflow Studio is where a developer builds automated processes without code. A flow starts from a trigger and runs a sequence of actions and flow logic. The blueprint still calls the tool Flow Designer; the product name is now Workflow Studio.

Flows are the recommended way to automate multi-step processes such as approvals, task creation and notifications. Older applications may still use legacy workflows built in the Workflow Editor, which work with activities on a canvas.

Triggerrecord, schedule, applicationActionslook up, create, updateFlow logicif, for each, waitOutputs and data pillsused by later steps

How it works

Building blocks

Building blockWhat it is
FlowTrigger plus steps; runs on its own when the trigger fires
SubflowReusable steps with inputs and outputs, called from flows, other subflows or scripts; no trigger
ActionOne reusable operation, such as Create Record or Ask for Approval; custom actions are built in Action Designer
SpokeA packaged set of actions, often for an outside system through Integration Hub

A flow belongs to the application selected when it is created, so it is packaged with that application like any other file.

Triggers

A trigger decides when the flow starts.

Trigger typeStarts the flow when
RecordA record is created, updated, or created or updated on a table, optionally with a condition
Date (scheduled)A set time arrives: once, daily, weekly, monthly or repeating
ApplicationAn application event occurs, such as a catalog item request or an inbound email

Record triggers take a condition, such as State is Submitted. Without one, the flow runs on every matching change.

Data pills and flow logic

Each trigger and action produces outputs. Later steps use them as data pills, dragged into fields, for example the Requested for of the trigger record.

Flow logic controls the path: If with Else If and Else, For Each over a list of records, Wait for a duration, Do the following in parallel and End Flow. A typical approval flow looks like this:

Request submittedAsk for ApprovalIf approvedupdate state, create taskElseupdate state, notify requester

Activating and running

A flow runs from its trigger only after it is activated. Editing an active flow does not change running behavior until you activate again.

The Run as flow property decides whose access applies. It can be the user who initiates the session, so that user's access controls apply, or the system user, so the flow works regardless of the user's own access.

Testing a flow

Use Test in Workflow Studio before activating. Testing bypasses the trigger condition and runs the flow with data you supply; for a record trigger you pick or create a record to use.

Every test produces execution details: each step's inputs, outputs, state and run time. Open them from the test result or from the Operations tab of Workflow Studio.

Debugging

Start with the execution details of the failed run and find the first step in error. Compare its input data pills with what you expected: a wrong pill or an empty lookup is the most common cause.

SymptomCheck
Flow never startsFlow not active, trigger table wrong, or trigger condition not met
Step errorsExecution details for that step's inputs and error message
No details for normal runsFlow reporting is off by default; details come from tests unless reporting is enabled
Update fails for some usersRun as is the initiating user, and that user fails an ACL

Execution details for production runs depend on the flow reporting level. Full reporting on every run costs performance, so it belongs on non-production instances.

How the exam asks about this

  • "Run steps when a request's State changes to Submitted." A flow with a record trigger on updated and a State condition.
  • "Reuse the same approval steps in several flows." Build a subflow with inputs and outputs.
  • "Find why a flow stopped at step four." Open the execution details and inspect that step's inputs and error.

What to remember for the exam

  • A flow is trigger plus actions and flow logic; a subflow has no trigger and is called by others.
  • Trigger types: record, date (scheduled) and application.
  • Data pills carry outputs from the trigger and earlier steps into later steps.
  • A flow responds to its trigger only after it is activated.
  • Test bypasses the trigger condition and creates execution details.
  • Execution details show each step's inputs, outputs and errors.
Watch out

A test run proves the steps work, not that the trigger fires. If the flow tests fine but never runs, check that it is active and that the trigger table and condition match the real record change.

Common mistakes

Forgetting to activate. A saved flow that was never activated does nothing when records change.

Building the same steps in every flow. Shared steps belong in a subflow or custom action, so one change updates every caller.

Writing a script when a flow fits. If the requirement is a multi-step process with approvals and tasks, a flow is the expected answer, not a business rule.

Check yourself

  • What does testing a flow do with its trigger condition?

    It bypasses the condition and runs the flow with the test data or record you supply.

  • Where do you look to see each step's inputs and outputs from a run?

    In the flow execution details, opened from the test result or the Operations tab of Workflow Studio.

  • When should you build a subflow instead of a flow?

    When the same steps are needed in several places; a subflow has inputs and outputs and no trigger, so other flows call it.

Topic 1 of 4 in Application Automation

Test yourself on Application Automation

The full ServiceNow CAD question bank has 600 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by ServiceNow. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.