Workflow blocks
Learn about blocks in Retool Workflows.
A block is an executable action within a workflow. You use blocks to:
- Interact with resources using SQL queries or API requests.
- Transform data and extend functionality with JavaScript and Python.
- Leverage AI with OpenAI's GPT models.
- Perform conditional logic to filter or branch data.
- Loop through data sets and execute queries for each item.
- Respond to webhook events.
How blocks work
You drag and drop blocks in the Workflow editor to assemble your workflow, then configure them to interact with data or perform actions. You connect blocks together to define the control flow which determines the order that each block executes.
Blocks can reference the results of previous blocks that have already executed.
Block model
Blocks in Retool Workflows are functionally similar to queries. They are designed to be modular and have internal state to which you reference in subsequent blocks. For example, query2.data
would reference the data returned by the query2 block.
Configuration and properties
All blocks have a configurable timeout setting.
You can write JavaScript almost anywhere in Retool using {{ }}
and component property values are available globally. This makes it possible to reference other properties when configuring a value.
For example, you can configure a Text component to display the value of a Text Input component with {{ textInput1.value }}
in the App editor. This also makes it possible to control behavior through truthy or falsy values. You can use expressions like a ternary operator to use different values based on a condition, such as the value of a Checkbox component.
Start block
The Start block is the first block in a workflow and cannot be removed. This block is where you configure settings to trigger the workflow using a schedule or webhook events.
Configure block settings
You can configure a number of settings for blocks. The settings available depend on the type of block and resource currently in use. Click ⫶ in a block to open its settings menu.
Available settings include:
- Use the block as an error handler.
- Format code syntax. You can also press ctrl L to format code.
- Switch SQL queries between raw SQL and GUI mode.
- Set a timeout (in ms). Blocks can have a maximum timeout of ten minutes (
600000
). - Duplicate or delete a block.
Block notes
You can add comments to a block that can be helpful to explain its function and leave notes for other users. Click the Notes button in a block and write a comment. Markdown formatting is supported.