Flow actions and subflows
Quick answer
Build reusable automation: action steps, inputs and outputs, subflows, and when a script step is justified.
Key takeaways
- Actions and subflows are how flows stay maintainable
- Inputs and outputs make automation testable
- Script steps are an exception, not a default
- Configure error handling explicitly on every external call
Actions are reusable units
An action takes inputs, runs steps such as look up records, create record or REST, and returns outputs. Because it is reusable, a well named action with clear inputs is worth more than the same logic copied into three flows.
Subflows
A subflow is a flow that other flows call, with its own inputs and outputs. Use subflows for shared process, for example an approval pattern used by several catalog items, so a change happens in one place.
Script steps
Flow Designer supports a script step, and it is easy to overuse.
- Prefer no code steps so the flow stays readable to process owners
- Use a script step for data shaping the standard steps cannot do
- Keep the script short and pure, no side effects that the flow does not report
- If a script step grows past twenty lines, move it into an action or a script include
Error handling
Set the error handling on each action so a failure either stops the flow or continues down an error path. Silent failures in automation are worse than loud ones.
Want to learn this properly?
Our live, instructor-led ServiceNow Training covers this hands-on, with real projects and a certification path.
Check your understanding
What makes an action reusable?
- A. Its name
- B. Defined inputs and outputs
- C. Running async
- D. Being in global scope
Show answer
B. Defined inputs and outputs
Declared inputs and outputs let any flow call it safely.
When is a script step reasonable?
- A. Whenever it is faster to type
- B. For data shaping no standard step covers
- C. For every REST call
- D. To avoid learning the UI
Show answer
B. For data shaping no standard step covers
Scripts fill gaps, they should not replace the no code steps.