Designing Steps
Available: Starter and Premium as a paid add-on
Overview
In STEP Orchestrator, each Step is a modular unit of work.
Steps can execute either a Salesforce Flow or an Apex Class, and are linked together to form a complete orchestration.
Each step runs in a fresh execution container with platform limits reset, ensuring even the most complex or resource-intensive jobs run safely.
Step Types
-
Flow Step
- Executes an Autolaunched Flow.
- Inputs are mapped into the Flow’s variables.
- Outputs are mapped back into the orchestration for use in later steps.
- Ideal for declarative automation, transformations, or record operations.
-
Apex Step
- Executes an Interface Apex Class.
- Inputs are passed into the Apex method as defined by its invocable variables.
- Outputs are collected from the Apex result object.
- Ideal for advanced logic, API callouts, or complex data handling.
Inputs and Outputs
-
Inputs:
Parameters the step consumes (e.g., record IDs, values, JSON strings).
Inputs can be mapped directly from orchestration variables or from outputs of previous steps. -
Outputs:
Data returned by the step (e.g., records, status, response payloads).
Outputs can be used as inputs into subsequent steps to create stateful step chaining.
Step Lifecycle
Each step follows the same lifecycle:
- Job — The orchestration schedules the step.
- Run — The Flow or Apex executes in its own transaction container.
- Result — The outcome is captured, including success/failure status.
- Outputs — Data produced is stored and made available to later steps.
Chaining Steps
Outputs from one step can be chained into another:
- Example:
- Step 1 (Apex): Calls an external API and returns a JSON payload.
- Step 2 (Flow): Parses the JSON into records.
- Step 3 (Apex): Updates Salesforce objects with parsed data.
This stateful chaining allows orchestrations to be context-aware and dynamic.
Best Practices
-
Choose the right step type:
- Use Flow for record operations or declarative automation.
- Use Apex for complex logic or external integrations.
-
Design for chaining:
Define outputs with reuse in mind, so later steps can easily consume them. -
Use small, modular steps:
Keep logic focused within each step for easier debugging and retries. -
Test individually:
Test Flows and Apex classes standalone before orchestrating them.
Example — Flow and Apex Combination
- Step 1 (Flow): Query Accounts and output a collection of record IDs.
- Step 2 (Apex): Perform API callouts for those Accounts.
- Step 3 (Flow): Update Salesforce records based on the API response.
Each step runs with fresh limits, passing outputs forward until the orchestration is complete.
Conclusion
Designing steps effectively is the foundation of a successful orchestration.
By combining Flows and Apex, leveraging inputs/outputs, and chaining steps together, you can build resilient, limit-safe, and dynamic processes.