When to use a sub-process
A sub-process is a process that another process runs as a step. Splitting logic out this way can make a workflow clearer and more reusable - but it also adds a moving part, so it is worth doing deliberately.
Use a sub-process when
- The same logic is needed in more than one place. Build it once and call it from every process that needs it, instead of rebuilding and maintaining copies.
- A process has grown hard to read. Lifting a self-contained chunk into its own process keeps the parent focused on the high-level flow.
- Work can run in parallel. Launch a sub-process per item and join the results later, so independent work runs at the same time rather than in sequence.
- A part of the flow has its own lifecycle. If a section needs its own versioning or its own access rules, a separate process gives it a clean boundary.
Keep it inline when
- The logic is used once and is small - a single step or a short branch is simpler than a whole separate process.
- Splitting it would scatter one readable flow across several processes for no real gain. Every hop between processes is something a reader has to follow.
Tip
Rule of thumb: reach for a sub-process when you catch yourself about to copy a chunk of logic, or when a single process has become too big to take in at a glance. Otherwise, keep it inline.
How to run one
Choose the action that matches whether the parent should wait:
- Launch Subprocess - start it and keep going.
- Await Subprocess - wait for launched sub-processes to finish.
- Launch and Await Subprocess - run one inline and wait for its result.
The caller passes values into the sub-process’s parameters and reads its return values back, exactly like configuring a single step. See Parameters and Return Values.
Related
- Process (Actions) - the actions that run sub-processes.
- When to use a datastore to store data (or when not to) - a related design decision about where data lives.
- Tasks, Processes, Process Instances - the concepts behind running one process from another.
Last updated on