Skip to main content
RapidDev - Software Development Agency
bubble-tutorial

How to set conditional logic for step execution in Bubble workflows: Step-by-Ste

Control which workflow actions run by adding Only When conditions to individual steps in Bubble. This tutorial shows how to skip or execute specific actions based on custom states, user roles, or data values, reducing the need for multiple redundant workflows and keeping your logic clean and maintainable.

What you'll learn

  • How to add Only When conditions to individual workflow actions
  • How to combine conditions with custom states for dynamic step execution
  • How to avoid common pitfalls when skipping steps that return data
  • How to simplify complex branching logic with conditional steps
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate8 min read15-20 minAll Bubble plansMarch 2026RapidDev Engineering Team
TL;DR

Control which workflow actions run by adding Only When conditions to individual steps in Bubble. This tutorial shows how to skip or execute specific actions based on custom states, user roles, or data values, reducing the need for multiple redundant workflows and keeping your logic clean and maintainable.

Overview: Conditional Logic in Bubble Workflow Steps

This tutorial covers adding Only When conditions to individual steps within a Bubble workflow. Instead of creating separate workflows for every possible branch, you can conditionally skip or execute actions within a single workflow. You will learn how conditions interact with Result of step X references, how to use custom states as condition inputs, and when it is safer to split logic into separate workflows versus using step-level conditions.

Prerequisites

  • A Bubble account with an existing app
  • At least one workflow already created in your app
  • Basic understanding of Bubble data types and expressions
  • Familiarity with the Workflow tab and action inspector

Step-by-step guide

1

Open a workflow and select an action to condition

Go to the Workflow tab and click on an existing workflow event (for example, When Button Submit is clicked). Click on the action you want to conditionally execute. In the action's property panel, you will see a field labeled Only when at the bottom. Click it to open the expression editor. This is where you define the condition that must be true for this action to run.

Expected result: The Only when field is visible in the action inspector and ready for an expression.

2

Add a basic Only When condition

In the Only when field, build an expression that returns yes or no. For example: Current User's role is Admin. This means the action will only execute if the logged-in user has the Admin role. You can use any dynamic expression — database fields, custom states, URL parameters, or input values. If the condition evaluates to no, Bubble skips this action entirely and moves to the next one in the sequence.

Pro tip: You can combine multiple conditions with and/or operators. For example: Current User's role is Admin and Input Form's value is not empty.

Expected result: The action now shows the Only when condition, and it will be skipped when the condition is false.

3

Use custom states as condition inputs

Custom states are ideal for controlling workflow step execution because they can be set earlier in the same workflow or on a previous user interaction. For example, set a custom state called should_send_email (yes/no) on the page based on a checkbox input. Then in your workflow, add Only when: Page's should_send_email is yes to the Send email action. This lets user choices dynamically control which steps run without creating separate workflows.

Expected result: The workflow action only fires when the custom state is set to yes, giving users control over optional steps.

4

Handle skipped steps that produce data

A critical nuance: if a skipped action produces data (like Create a new Thing), any later step referencing Result of step X will receive an empty value. This can cause unexpected behavior or errors. To handle this safely, either ensure dependent steps also have an Only when condition that matches, or restructure so data-producing steps are never conditionally skipped when later steps depend on their output. If you need branching with data dependencies, consider using separate workflows or custom events instead.

Pro tip: If you need a workflow to always create a record but conditionally modify it, put the Create action without a condition and add Only when to the Make changes action.

Expected result: Your workflow handles skipped data-producing steps gracefully without empty reference errors.

5

Replace multiple workflows with conditional steps

Instead of creating three separate Button Click workflows for different user roles, create one workflow with conditional steps. For example: Action 1 (no condition) — Create a new Order. Action 2 (Only when Current User's role is Admin) — Make changes to Order, set status = approved. Action 3 (Only when Current User's role is not Admin) — Make changes to Order, set status = pending. This consolidates logic and makes it easier to maintain.

Pro tip: For very complex branching (more than 3 paths), it is often cleaner to use custom events instead — each custom event handles one path and is triggered conditionally from the main workflow.

Expected result: A single workflow handles multiple user roles by conditionally executing different actions.

6

Test conditional steps with the Debugger

Open your app in Preview mode and activate the Debugger by clicking the bug icon. Trigger the workflow and step through each action. The Debugger shows whether each action was executed or skipped based on its Only when condition. Check that skipped actions show as skipped (not errored) and that the workflow continues past them correctly. Test with different user roles, input states, and custom state values to verify all paths.

Expected result: The Debugger confirms that conditional actions are correctly executed or skipped based on the Only when expression.

Complete working example

Workflow summary
1CONDITIONAL STEP EXECUTION WORKFLOW SUMMARY
2================================================
3
4SCENARIO: Order submission with role-based processing
5
6PAGE CUSTOM STATES:
7 Page
8 - should_notify (yes/no) set by checkbox
9 - order_priority (text) set by dropdown
10
11WORKFLOW: When Button Submit Order is clicked
12
13 Action 1: Create a new Order
14 (No condition always runs)
15 customer = Current User
16 items = RepeatingGroup Cart's List of Products
17 total = CartTotal's value
18 status = pending
19
20 Action 2: Make changes to Result of Step 1
21 Only when: Current User's role is Admin
22 status = approved
23 approved_by = Current User
24 approved_date = Current date/time
25
26 Action 3: Make changes to Result of Step 1
27 Only when: Current User's role is not Admin
28 status = pending_review
29
30 Action 4: Send email
31 Only when: Page's should_notify is yes
32 To: Result of Step 1's customer's email
33 Subject: Order Confirmation
34 Body: Your order has been placed.
35
36 Action 5: Make changes to Result of Step 1
37 Only when: Page's order_priority is Rush
38 priority = high
39 rush_fee = Result of Step 1's total * 0.15
40
41 Action 6: Navigate to page order-confirmation
42 (No condition always runs)
43 Send: Result of Step 1
44
45KEY RULES:
46 - Skipped actions return empty for Result of step X
47 - Conditions on styles cannot be overridden
48 - Multiple conditions use AND logic by default
49 - Use custom events for complex branching (3+ paths)
50 - Always test with Debugger to verify skip behavior

Common mistakes when setting conditional logic for step execution in Bubble workflows: Step-by-Ste

Why it's a problem: Referencing Result of step X from a conditionally skipped step

How to avoid: Add matching Only when conditions to dependent steps, or restructure so data-producing steps always run.

Why it's a problem: Using step conditions when workflow-level conditions would be simpler

How to avoid: If all actions in a workflow share the same condition, put the condition on the workflow event itself rather than on each action.

Why it's a problem: Forgetting that skipped steps still allow subsequent steps to run

How to avoid: If you need to stop the workflow entirely, use the Terminate this workflow action or put the condition at the workflow level.

Why it's a problem: Overcomplicating a single workflow instead of using custom events

How to avoid: Split complex branching into separate custom events and trigger them conditionally from the main workflow.

Best practices

  • Use Only when on individual actions for simple two-path branching within a workflow
  • Put conditions at the workflow level when all actions share the same execution criteria
  • Use custom states to pass user choices into workflow conditions without additional database reads
  • Never reference Result of step X from a step that might be skipped — guard dependent steps with matching conditions
  • Use the Debugger to step through conditional workflows and verify which actions execute
  • Document complex conditional logic with Notes attached to the workflow event in the editor
  • For more than three conditional branches, use custom events instead of step-level conditions
  • Test all condition paths including edge cases like empty inputs or logged-out users

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I am building a Bubble.io app and need to run different workflow actions depending on the user's role and input selections. How do I use Only When conditions on individual workflow steps? What are the gotchas with Result of step X when steps are skipped?

Bubble Prompt

In my order submission workflow, add conditional logic so that admin users auto-approve orders while regular users set status to pending. Also add an optional email notification step controlled by a checkbox. Use Only When conditions on individual actions.

Frequently asked questions

What happens to subsequent steps when an action is skipped?

They continue to run normally. Only the specific action with the unmet Only when condition is skipped. The workflow does not stop.

Can I use Or logic in an Only When condition?

Yes. Use the or operator in the expression editor to combine multiple conditions. For example: Current User's role is Admin or Current User's role is Manager.

Is there a performance cost to adding many Only When conditions?

The conditions themselves are lightweight. However, if each condition includes a Do a search for expression, those searches consume workload units even when the action is ultimately skipped.

Can I conditionally skip a step in a backend workflow?

Yes. Backend workflow actions support Only when conditions the same way as frontend workflows. The behavior is identical.

How do I debug which steps were skipped?

Use the Debugger in Preview mode. Step through the workflow and it will show each action's status — whether it executed or was skipped due to its condition.

Can RapidDev help optimize complex workflow logic?

Yes. RapidDev specializes in Bubble development and can help refactor complex conditional workflows into maintainable, efficient structures using custom events and backend workflows.

Should I use conditions on steps or separate workflows?

For simple two-way branching, step conditions are cleaner. For three or more paths with different data dependencies, separate workflows or custom events are safer and easier to maintain.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.