Step Types
Every step in the steps list must have exactly one type key that determines what it does.
Action
Calls a ServiceNow action (e.g., Look Up Record, Create Record, Send Email).
yaml
- action: lookup_record
name: Find the Caller
inputs:
table: sys_user
conditions: "sys_id=$trigger.current.caller_id"The action value is an alias (like lookup_record) or the full SN action name. Common aliases:
| Alias | Action |
|---|---|
lookup_record | Look Up Record |
create_record | Create Record |
update_record | Update Record |
delete_record | Delete Record |
create_task | Create Task |
update_field_values | Update Field Values |
send_email | Send Email |
send_notification | Send Notification |
log | Log |
run_script | Run Script |
Subflow
Calls another subflow by sys_id or name:
yaml
- subflow: abc123def456abc123def456abc123de
name: Notify On-Call
inputs:
incident: $trigger.current.sys_idIf / Else If / Else
Conditional branching:
yaml
- if: "$trigger.current.priority = 1"
then:
- action: send_email
inputs:
to: oncall@example.com
subject: P1 Alert
body: "Priority 1 incident created."
else_if:
- condition: "$trigger.current.priority = 2"
then:
- action: log
inputs:
message: "P2 incident, logging only."
else:
- action: log
inputs:
message: "Low priority, no action."Rules:
thenis requiredelse_ifandelseare optional- Multiple
else_ifblocks are allowed - Each
else_ifneeds aconditionandthen
Condition Inputs
For fine-grained control, use inputs instead of the inline condition string:
yaml
- if: "$trigger.current.state"
inputs:
operator: "="
rhs: "6"
then:
- action: log
inputs:
message: ResolvedFor Each
Loop over a list:
yaml
- for_each: "Loop through users"
inputs:
items: $find_users.record_list
do:
- action: send_email
inputs:
to: $current.email
subject: Notification
body: "Hello!"Do Until
Loop until a condition is met:
yaml
- do_until: "Retry until success"
inputs:
operator: "="
rhs: "true"
do:
- action: run_script
inputs:
script: "// attempt operation"Parallel
Run branches simultaneously:
yaml
- parallel: "Check multiple systems"
branches:
- - action: lookup_record
name: Check CMDB
inputs:
table: cmdb_ci
- action: log
inputs:
message: "CMDB check done"
- - action: lookup_record
name: Check Users
inputs:
table: sys_userEach item in branches is a list of steps that runs as one parallel branch.
Try / Catch
Error handling:
yaml
- try: "Attempt API call"
do:
- action: lookup_record
inputs:
table: sys_user
conditions: "sys_id=invalid"
catch:
- action: log
inputs:
message: "API call failed, handling gracefully."Both do and catch are required.
Wait
Pause execution:
yaml
- wait: "Wait for approval"End
Stop the flow:
yaml
- end: "Stop here"Decision
Decision table:
yaml
- decision: "Route by category"
inputs:
table: my_decision_tableSet Flow Variables
Assign values to scratch variables:
yaml
- set_flow_variables: "Store result"
inputs:
counter: "1"
status: $find_record.record.stateAssign Outputs
Set subflow output values:
yaml
- assign_outputs: "Return result"
inputs:
success: "true"
record_id: $create_record.record.sys_idCommon Fields
All step types support these optional fields:
| Field | Description |
|---|---|
id | Unique step identifier (for pill references and updates). |
name | Display name shown in Flow Designer. |
comment | Developer comment (not shown at runtime). |
inputs | Key-value map of configured inputs. See Input Formats. |