Run another workflow with the Workflow block
Learn how to run a workflow from within a workflow.
The Workflow block passes data from the current workflow to another. This is useful for reducing complexity as it enables you to:
- Break down workflows into more manageable functions that perform specific actions (e.g., perform multiple API requests).
- Reuse the same actions across multiple workflows, reducing the amount of duplication across similar workflows (e.g., transform and store data in Retool Vectors).
The Workflow block triggers the specified workflow, passing the provided data for it to use. Once run, the specified workflow returns the data back to the current workflow for it to continue.
Add a Workflow block
The Workflow block is powered by the Retool Workflow resource. You can also use this resource in web and mobile apps to run workflows.
To run another workflow, add a Workflow block to the canvas. You then select the workflow to run and specify the parameters to pass:
Parameters | Description |
---|---|
Raw | Reference raw data. This can be any value, such as a string or all JSON data from a previous block (e.g., query1.data ). |
JSON | Create a set of key-value pairs using input fields. |
None | Do not pass any data. |
You do not have to pass any data to the specified workflow. For example, you may want to run a workflow that retrieves data for your primary workflow to then process.
Run the specified workflow
Workflows run from within a workflow operate in a similar way as a webhook-triggered workflow. When run, data passed from the primary workflow is made available on startTrigger.data
. You must include a Response block in the workflow to be run—this returns data back to the primary workflow.