Bubble Docs
Search
K
Comment on page

Workflows

This section covers workflows - the engine in your app that makes stuff happen.
Workflows are the engine of your application – they are how you instruct Bubble to respond to what the user does, such as clicking a button, with a set of actions that can do anything from hiding/showing or animating things on the page to making changes in the database and make external API calls.
A workflow is the combination of an event that triggers one or more actions.

Events

An event is anything that tells a workflow to run, such as:
  • A button being clicked
  • An input's value being changed
  • A condition being true
  • A user logging in or out
  • Changes in the database
Events can run on a page, or they can be triggered server-side (which doesn't require that a user has a page open).
Article series: Events

Actions

Actions are the operations that take place when a workflow is triggered by an event. You can place as many actions as you need inside one workflow. Actions can do things like:
  • Creating, updating and deleting things in your database
  • Hiding, showing and animating elements on the page
  • Creating user accounts and logging users in/out
  • Sending emails
  • Navigating to a different page
  • Loading data
  • Using plugins, such as making a payment
This is not an exhaustive list, but as you can see, the actions in a workflow is how you make your app respond to a user's actions or changes in conditions.
Article: Actions

Organizing workflows

Workflows in the workflow editor can be categorized in two ways for easier navigation: by creating folders and adding colors to workflows. There are no rules or best practices on how to best organize your workflows, but we recommend giving some thought as to how you can combine colors with folders to efficiently navigate pages with a lot of workflows.

Colors

Each workflow you add can be given one of the following colors:
  • Gray (default)
  • Blue
  • Red
  • Green
  • Orange
  • Purple
  • Cyan
  • Brown
Workflow colors are set on the settings of the workflow in the Event color dropdown.

Folders

You can also organize workflows into folders, available by expanding the workflow folder navigator on the left-hand side of the workflow editor. There are no folders by default, but you can create as many as you need. Workflows can belong to one folder, and workflows that are in no folders will be visible in the All workflows view or No folder assigned view.
In the example above we have created a folder called Page load where we can place anything related to the page loading. Also notice the Workflow tree underneath the Workflow folders, which will reflect whichever folder you have open to leat you navigate workflows on complex pages.

Errors in workflows

Workflows can hit errors in different scenarios. For example:
  • A user tries to log in using the wrong credentials
  • A user tries to sign up using an email that already exists in the database
  • A credit card payment fails because the card is declined
If a workflow runs into an error, it will stop running on the action where the error happened. Any previous actions will not be reverted.
Note that the errors we are discussing in this section are related to system errors, and not to errors that are flagged by Bubble's issue tracker.

Handling errors

Bubble's default way to communicate most errors is to show the error in the browser's standard message popup. You can instruct Bubble to handle errors on specific elements or more broadly on a page by using two different events. The links below point to guides for each type:

An element has an error running a workflow

This event will catch errors that happen related to a specific element. For example, if a Log in button connected to a workflow containing the Log the user in action generates an error, the error will be connect to that button.

An unhandled error occurs

This event will catch errors more broadly: any error on the page will trigger it unless it's caught by another error event.

Workflow timeouts

In rare cases, a workflow can time out. Currently, if a workflow has been running without being able to finish within 5 minutes, it will be stopped. Any actions that did finish before that will not be reverted.
Workflow timeouts will mostly only happen on workflows that are unusually complex or that try to process a very large volume of data. For example, actions like Make changes to a list of things is good for shorter lists, but can time out if you include too many entries. We do not recommend using any actions that involve making changes to a list of things on more than 100 things.
If you need to process a longer list of items, you may check out the more advanced, but also more performance-friendly recursive workflows.

Running too many workflows at once

Running too many workflows at once can also make some or all of them time out because you run out of available capacity. It's important to keep in mind that as your app scales with more users, the number of workflows being triggered will expand along with it. Be careful adding workflows to page load that make changes in the database for example; if a lot of users load the page at the same time, this can overload the system.
To mitigate this, consider spacing out workflows to the extent possible, or check your options for getting more capacity.