Workflows: Advanced Concepts
This page covers the patterns and techniques for building non-trivial workflows: referencing data across steps, conditional logic, data transformation, AI-powered automation, human-in-the-loop approvals, and more.Referencing Data Between Steps
Most workflow actions need data from earlier steps: the record that triggered the workflow, a value returned by an AI action, a field from a database lookup. Variables are how you pass data from one step to the next. How it works:- In any action’s settings, click the + button to open the variable picker.
- Browse the list of previous steps (the trigger and every action that ran before this one).
- Select a field. Its value will be injected at runtime when the workflow runs.

A new bug was reported by [+ Trigger → email]: [+ Trigger → description].
Where variables come from:
- Trigger data - the record, form submission, or webhook payload that started the workflow. Available in every subsequent step.
- Action outputs - the result of any previous action. For example, an AI Categorize step outputs a
categoryfield; a Get Record step outputs all the record’s fields. - Loop variables - inside a Loop, use
{loopVariables.fieldName}to access the current item’s data. See the Loop section below.
+ → Trigger → message) with the user’s account plan from Step 1 (+ → Step 1 → plan).
Branch
The Branch action splits your workflow into two paths based on a condition.- If the condition is true, the workflow follows the “yes” path.
- If the condition is false, it follows the “no” path.


Filter
The Filter action checks a condition and stops the workflow if the condition is not met. Use it when you only want the workflow to continue for certain records or situations, and there’s nothing to do in the “no” case. Example: A workflow triggers on every new Airtable record. Add a Filter at the start to stop the workflow if the record’s “Status” field is not “Ready”. Only “Ready” records will proceed through the rest of the workflow.
Loop
The Loop action runs a group of actions once for each item in a list. How it works:- You point the Loop at an array of items (e.g. a list of records returned by a “Get Records” action).
- The actions inside the loop run once per item.
- Inside the loop, use
{loopVariables.fieldName}to access the current item’s data and{loopCounter}to know which iteration you’re on. - After all items are processed, the workflow continues with the next action after the loop.


Nested Loops
You can place a Loop inside another Loop to handle lists within lists. When to use it: When each item in your outer list contains its own list of items that each need individual processing. Example: You have a list of Tasks, and each Task has multiple Tags. You want to create one record per Task and Tag combination.Transform Data
The Transform Data action lets you create new values using formulas - the same formula syntax available in Softr Databases. Use it to reshape, calculate, or extract data between steps without writing code. Common use cases:- Arithmetic: Increment a counter (
{vote_count} + 1), calculate a total, compute a percentage - String manipulation: Convert text to lowercase, concatenate fields, extract a substring
- Date extraction: Get the day of the week from a date (
WEEKDAY({submission_date})), format a date for display - Conditional values: Return different values based on a condition using
IF()formulas

| Transform Data | Run Custom Code | |
|---|---|---|
| Best for | Simple calculations, string formatting, date operations | Complex logic, JSON parsing, multi-step transformations |
| Syntax | Softr formula language | JavaScript or Python |
| Setup | Zero setup - just write a formula | Define input variables, write code |
| Plan requirement | All plans | Paid plans |
vote_count. Step 2: Transform Data with formula {vote_count} + 1. Step 3: Update the record with the new value from Step 2.
Run Custom Code
The Run Custom Code action executes JavaScript or Python inside your workflow. It’s the escape hatch for logic that formulas can’t express - parsing complex JSON, applying multi-step transformations, or computing values that would require deeply nested branches. How inputs and outputs work:- Define input variables in the action settings and map them to outputs from previous steps.
- Inside the code, access these values through the input variables.
- Return a value from your code - it becomes available as a variable in subsequent steps.

Run Custom Code is available on paid plans.
response.data.items[0].name) and return them as clean variables for the next step.
Call API
The Call API action makes an outgoing HTTP request to any REST endpoint. Use it to push data to external services, fetch information from third-party APIs, or connect with any system that supports HTTP. Key settings:- Method: GET, POST, PUT, PATCH, or DELETE
- URL: The endpoint you’re calling
- Headers: Authentication tokens, content type, and other metadata
- Query parameters: Key-value pairs appended to the URL
- Request body: The JSON payload to send (for POST, PUT, PATCH)

| Code | Meaning | What to check |
|---|---|---|
| 200 | Success | Request worked as expected |
| 400 | Bad Request | Check your request body or parameters - something is malformed |
| 401 | Unauthorized | Check your API key or authentication headers |
| 404 | Not Found | Check the URL - the endpoint or resource doesn’t exist |
Call API is available on the Professional plan and above.
Authorization header with your API key, and the CRM creates a new contact automatically.
Structured Output from AI Actions
By default, AI actions return freeform text - useful for generating content, but difficult to use in Branch conditions or record updates because the format can vary. Enable Structured output to get back a JSON object with typed fields instead. This makes the AI’s response predictable and machine-readable, so you can reliably branch on it, store individual fields, or pass specific values to later steps. How to enable it:- In any Custom Prompt AI action (Softr AI or bring-your-own-key), toggle Structured output on.
- Provide a JSON schema that describes the fields and types you expect.


category and confidence - that you can reference in subsequent steps. No risk of the model returning unexpected text or varying its format between runs.

AI + Branch Patterns
Combining AI actions with Branches is one of the most common advanced patterns. The AI classifies or analyzes data, and the Branch routes the workflow based on the result.Basic AI routing
category value. The Branch checks that value and sends the workflow down the appropriate path. Each path can notify a different team and update the original record with the assigned category.
Confidence-gated routing
When you need more control, use a Custom Prompt with Structured output that returns both a category and a confidence score. Then branch on the confidence level:Choosing an AI Model
Softr workflows give you access to models from OpenAI, Anthropic, Google, Mistral, and DeepSeek. The right model depends on the complexity of the task - using the most powerful model for every step wastes credits and slows down your workflow.| Task type | Recommended tier | Examples |
|---|---|---|
| Classification and routing | Smaller, faster models | Claude Haiku, GPT-4.1 mini, GPT-5 nano |
| Writing, summarization, data extraction | Mid-tier models | Claude Sonnet, GPT-4.1, GPT-5 mini |
| Complex reasoning, code generation, multi-step analysis | Top-tier models | Claude Opus, GPT-5, o3 |

Human-in-the-Loop
Some workflows should pause for human judgment rather than proceeding fully automatically. Interactive actions pause the workflow, send a message with response options, and resume based on the person’s decision.When to use it
- High-stakes decisions: expense approvals, content publishing, permission changes
- AI confidence is low: the AI categorized something but isn’t sure (see Confidence-gated routing above)
- Compliance requirements: a human must review before certain actions proceed
Slack Interactive Messages
The Slack - Send Interactive Channel Message and Slack - Send Interactive Direct Message actions send a Slack message that includes buttons. The workflow pauses until the recipient clicks a button, then resumes on the corresponding branch. Example - Expense approval workflow:App-Triggered Workflows and UI Feedback
When a workflow is triggered by a user action inside your Softr app (clicking a button or submitting a form), the user is waiting for a response. These workflows are synchronous from the user’s perspective, so you can control what they see while the workflow runs and after it completes.Wait Screen
The Show Wait Screen action displays a loading overlay in the app while the workflow processes. Add a custom message so the user knows what’s happening (e.g., “Processing your vote…” or “Generating your report…”).
End User Interactions
The End User Interactions action defines what happens after the workflow completes:- Toast message: Show a success, info, warning, or error notification with a custom title and message
- Navigation: Stay on the current page, open a different page, open a record’s details page, open an external URL, refresh the form, or close a modal
- Reload blocks: Toggle Reload all blocks on current page to refresh data displayed in the app - essential when your workflow updated a record that’s visible on screen

Wait screens and End User Interactions only apply to app-triggered workflows (Run Custom Workflow trigger). They are not available for database triggers, schedule triggers, or webhooks.
Selective Context Pattern
When using AI to process information from your database, a common mistake is dumping all your records into a single AI prompt. This is expensive, slow, and often produces worse results because the AI has too much noise to sift through. The selective context pattern solves this by using a two-pass approach: a small AI model first selects which records are relevant, then only those records are passed to the main AI task. The pattern:- Pass 1 is cheap: a small model reads short titles and picks the relevant ones. This can process hundreds of items for minimal cost.
- Pass 2 is focused: the larger model only receives the 3-5 records that actually matter, so it produces higher-quality output with less noise.
- Total cost is lower than sending everything to a large model in a single prompt.