ServiceNow Concepts
Background on how ServiceNow stores and runs flows. Useful if you’re writing YAML and want to understand what’s happening under the hood.
Flows vs Subflows
Section titled “Flows vs Subflows”ServiceNow has two types:
- Flow — starts automatically when a trigger fires. Has a trigger, no input parameters.
- Subflow — called from other flows or subflows. Has input/output parameters, no trigger.
In YAML, set type: flow or type: subflow.
Triggers
Section titled “Triggers”A trigger defines what starts a flow. Three categories:
- Record — fires on record create, update, or both on a specified table
- Scheduled — fires on a time schedule (daily, weekly, monthly, repeat, once)
- Application — fires on an application event (Service Catalog, inbound email, Knowledge Management, etc.)
Each flow has exactly one trigger.
Steps are the building blocks. Types:
- Actions — call platform actions (Look Up Record, Create Record, Send Email, etc.)
- Subflow calls — invoke another subflow
- Logic containers — control flow with If/Else, For Each, Do Until, Parallel, Try/Catch
- Flow variables — set scratch variable values
- Output assignment — set subflow output values
Steps form a tree — logic containers hold child steps.
Data Pills
Section titled “Data Pills”Data pills pass data between steps in Flow Designer. A pill is a field value, step output, or input parameter that gets wired into another step’s input.
In YAML, pills are $source.field references. See Pill References.
Sources: trigger fields, subflow inputs, scratch variables, step outputs.
Published vs Draft
Section titled “Published vs Draft”- Draft — editable, not active
- Published — compiled and active; the platform runs this version when the trigger fires
Publishing compiles the flow so the platform can execute it. flowctl handles this automatically when you set status: published.
Every flow belongs to an application scope that controls table access and visibility.
access: public— callable from any scopeaccess: package_private— only accessible within its own application
Run As
Section titled “Run As”Controls the security context:
system— full system privilegesuser— privileges of the user who triggered the flow
Encoded Queries
Section titled “Encoded Queries”ServiceNow uses “encoded query” strings for conditions:
priority=1^active=true^stateNOT IN6,7Meaning: priority equals 1 AND active is true AND state is not in (6, 7).
Operators: =, !=, >, <, LIKE, IN, NOT IN, ISEMPTY, ISNOTEMPTY, STARTSWITH, ENDSWITH, BETWEEN, CHANGESFROM, CHANGESTO, and more.
Conditions join with ^ (AND) or ^OR (OR).