Data workflow order/behavior


I’m bumping into a workflow behavior that I don’t understand.

I tested it in the very simple design/workflow below.



The app allow user to add a text in the database. Messages under the button are not visible on page load.

I want the app to save only new texts (and confirm it by showing “New text saved”). If the text was already in the database, then nothing is saved and the “Text already saved previously” is shown.

BUT, when I run this in the debugger, the condition for showing “Text already saved” is green, even if the text is new. The app shows “Text already saved previously” and the workflow is terminated. When I check the database, the new text has indeed been saved, although this should have occured in Step 3, that did not run in the debugger.

Any idea on why this behaves like this and how to get the wanted behavior?

Thank you so much in advance!

You should assume that Bubble will execute Step 3 at the same time that it executes Step 1 - that’s because there is no dependency between Step 3 & Step 1, so Bubble tries to get ahead of time and sets both off at once. This is one of the most confusing aspects of Bubble, but in most situations it’s actually beneficial.

In your example here the way to get around it is to put the conditions on the workflow itself, and to make a clone of the workflow so that you have:

  1. That handles the case where Text doesn’t exist
  2. That handles the case where the Text does exist

Alternatively you could handle this in one workflow, just as you are, but you could place the condition on Step 3 itself, and then display your alert message after that step, only if the Result of the Create Thing step is empty.

1 Like

I suspected something like this. It is confusing indeed, but I now get how it can be beneficial, so it makes sense.

Just to be sure: workflows do have dependency? (as in “Bubble won’t set every workflows at once”)

Thank you very much

If you enforce dependency then they do. If you don’t then you should’t assume that any Step has completed before any other has begun.

So, if you make Step 2 conditional on something in Step 1 then you have forced a dependency between Steps 1 & 2 and Bubble will respect that.

This is some guidance on this from a Bubble support email to someone else a while ago - there’s a few posts out there on this though I can’t put my hands on them right now.

For efficiency purposes, workflows run in parallel across the server and the front end. Despite the names “Step 1”, “Step 2”, it is important to note that a given step does not necessarily wait for the previous one to complete before triggering the next one. The following is some information about Bubble workflow logic and general recommendations. Please also note that steps and actions are used interchangeably, but steps may be used in these examples when the order is important to note.
General rules about how workflows run:

  • Frontend workflow actions run in order but the next action does not wait on the previous action to be complete before triggering.
  • Backend workflows are triggered as soon as the workflow is triggered, independently from steps. For example, a ‘Schedule API Workflow’ action will be triggered as soon as the workflow is triggered even if it is placed last in the workflow action sequence.
  • Custom events run in sequence, not parallel. If Workflow 1 triggers a custom event that starts Workflow 2, Workflow 2 will complete before the remaining actions in Workflow 1 run.
  • Searches aren’t always immediately updated with new data. So if you create a new item, and then try to retrieve it via search, it may or may not work; you should not rely on this.
  • Retrieving a thing from “result of step X” where step X is the “Create…” step should always be safe.

Workarounds to help achieve workflow consistency:

  • When a workflow trigger (eg. a button) can have multiple results based on conditions, it is safer to create multiple workflows and place the conditions at the workflow level instead of creating one workflow with all possible actions and placing the conditions at the action level.
  • In a workflow with two actions, if Step 2 is using a condition based on a search depending on data manipulated in Step 1, then Step 1 should be implemented into a custom event to make sure it is finished before moving on to Step 2.
  • If a backend workflow should be triggered after other steps in the workflow, then it should be implemented in a custom event placed after the steps that need to come first.
  • The safest way to use data from one step to another is to use the “result of step X” operators instead of searches.
  • We do not offer the explicit ability for an action to wait for a workflow to be over before moving on to the next step; however, using ‘add a pause before next action’ action is usually an effective workaround.

Thank you so much. Saving this preciously for future reference :+1:

As i have created Appointment scheduling system in webpage. now that available time should display in repeating group, so that people can book from there, so what will be workflow for that?

this is where admin will select the available time,
i want that time should display on other page for users to book the schedule

Is this in the docs anywhere - it is GOLD and should be required reading.