Skip to main content

Workflow control flow

Learn about the order of operation for blocks in Retool Workflows.

A workflow contains blocks that connect together and execute sequentially during a run. This defines the order of operation and flow of data, known as the control flow. The connecting line between blocks visually represents the control flow, which can be a single path or branch to perform parallel operations.

Control flow

Order of operation

Any block that is part of the control flow is executed during a workflow run, beginning with the startTrigger block.

The following example illustrates a workflow that retrieves data from Github, processes the data, and inserts it into a PostgreSQL database.

Each block can access data from any other block that has already executed. For example, the getDataFromGithub Resource query retrieves data which the processData block uses. The output from processData is then used to run the upsertToPostgres block to update a database.

Control flow paths

The control flow is not limited to a single path. A block can output data to multiple blocks that perform parallel actions, creating multiple paths. The Branch block can also perform conditional logic that outputs different results along different paths.

The following example illustrates a workflow that retrieves a list of customers. It then iterates through the list of customers to check whether they were a sales lead. If they were, it notifies the Sales team. If not, it sends the customer a welcome email.

You can always reference a previous block that is not currently part of the same control flow path. The Workflow IDE automatically connects the blocks together and displays the connecting line.


Functions are reusable blocks that operate outside of the control flow. They do not appear on the canvas nor do they execute automatically. A function only executes when called from a JavaScript or Python Code block. A function is still ultimately executed by the control flow as it requires a block to trigger it.

Global error handlers

Retool enables you to configure blocks to be global error handlers that run whenever an error occurs. These blocks do not have to be part of the control flow to run in the event of an error.