Step Types
Every step in the steps list needs exactly one type key.
Action
Section titled “Action”Calls a ServiceNow action (Look Up Record, Create Record, Send Email, etc.).
- action: lookup_record name: Find the Caller inputs: table: sys_user conditions: "sys_id=$trigger.current.caller_id"The action value is an alias or the full SN action name.
| 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
Section titled “Subflow”Call another subflow by sys_id or name:
- subflow: abc123def456abc123def456abc123de name: Notify On-Call inputs: incident: $trigger.current.sys_idIf / Else If / Else
Section titled “If / Else If / Else”Conditional branching:
- 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
Section titled “Condition Inputs”For fine-grained control, use inputs instead of the inline condition string:
- if: "$trigger.current.state" inputs: operator: "=" rhs: "6" then: - action: log inputs: message: ResolvedFor Each
Section titled “For Each”Loop over a list:
- 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
Section titled “Do Until”Loop until a condition is met:
- do_until: "Retry until success" inputs: operator: "=" rhs: "true" do: - action: run_script inputs: script: "// attempt operation"Parallel
Section titled “Parallel”Run branches simultaneously:
- 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
Section titled “Try / Catch”Error handling:
- 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.
Pause execution:
- wait: "Wait for approval"Stop the flow:
- end: "Stop here"Decision
Section titled “Decision”Decision table:
- decision: "Route by category" inputs: table: my_decision_tableSet Flow Variables
Section titled “Set Flow Variables”Assign values to scratch variables:
- set_flow_variables: "Store result" inputs: counter: "1" status: $find_record.record.stateAssign Outputs
Section titled “Assign Outputs”Set subflow output values:
- assign_outputs: "Return result" inputs: success: "true" record_id: $create_record.record.sys_idCommon Fields
Section titled “Common Fields”All step types support these optional fields:
| Field | Notes |
|---|---|
id | Unique 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. |