Skip to main content

Import and run a workflow from an app

The Retool Workflows query resource enables you to run a workflow from an app. This is useful for reducing complexity as it enables you to:

  • Break down complex sets of queries into more manageable functions that perform specific actions (e.g., perform multiple API requests).
  • Reuse the same actions across multiple apps, reducing the amount of duplication (e.g., transform and store data in Retool Vectors).

The query triggers the specified workflow, passing the provided data for it to use. If the workflow produces data, it is returned back to the current app.

Run another workflow from a workflow

You can also use the Workflow block within a workflow for the same functionality.

Import a workflow

Open the Code tab, add a new query, and select Import a Workflow. This populates a query with the Retool Workflows resource. You then select the workflow to run and specify the parameters to pass:

ParametersDescription
RawReference raw data. This can be any value, such as a string or all JSON data from a previous block (e.g., query1.data).
JSONCreate a set of key-value pairs using input fields.
NoneDo 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 to then use in the app.

Return data to the app

Workflows run from within an app operate in a similar way as a webhook-triggered workflow. When run, data passed from the app is made available on startTrigger.data. You must include a Response block in the workflow to be run as this is how it returns data back to the app. If you want to trigger a workflow without returning data back to the app, you don't need a Response block.