Forum Documentation Showcase Pricing Learn more

Workflow real current behavior

##First realization
When you trigger a custom event the two workflows run in parallel.
Consider having the following simplified workflow


  • Create some data


  • Trigger Event1
  • Search for data created in event 2 <---- no data is found since they might not be really created yet

If this is really the case, that these two events run in parallel, then documentation is necessary and/or redesign to make it explicit that it works in parallel.

Let us know if this is really how it works. Thanks

##Second realization
If inside the workflow you have data being created then these data are not yet available and you should use the workflow’s data instead
Consider the following workflow, simplified:


  • Create some data
  • Trigger Event2


  • Search for data created in event1 <---- no data is found since the data are not really commited to the persistent storage yet

Once again documentation and/or design would be very helpful to make this explicit

####What worked after all
The following workflow (not simplified) works as expected:
Add New Product Button Event:

  • Trigger Create Vendor If Not Exists event
  • Trigger Get Vendor If Already Exists event

(so the two triggered events run in parallel but conditionally in order for only one’s actions to be executed)

Create If Not Exists Event:

  • Create Vendor
  • Trigger Create Product event (by passing the created vendor)

Get Vendor If Already Exists Event:

  • Trigger Create Product event (by passing the vendor found in the database after a search)

Create Product Event:

  • Create new Product (using the vendor passed in as argument in this workflow)
  • Save Product created in step1 to Current User

Let us know if there is a simpler way to implement this in Bubble. Appreciate it.

Sorry for taking a few days to get back to you on this. Great question. So what should be going on is this:

-Custom events run in sequence, not parallel. If a workflow 1 triggers a custom event that starts workflow 2, workflow 2 should complete before anything in workflow 1 runs.

-But, searches aren’t always immediately updated with new data. So if you create a new item, and then try to retrieve it via a search, it may or may not work; you should not rely on this.

-Retrieving it via “result of step X” where step X is the “Create…” step should always be safe.

-However, what you’re running into is that if you create it in a custom workflow, there’s no way of accessing it from the parent workflow, which is why your working solution is more complicated than you’d like it to be.

So… basically what would make your life easier here is a way of referencing something created by a custom workflow. Maybe we could have a “return to parent workflow” action in custom workflows, that would let you set something that could be accessed as the result of the custom workflow, or some similar mechanism. We’ll think about this…

Meanwhile, another way you could work around this is saving the newly-created item to an element on the page, which should work correctly in between custom workflows.


Hi there, thanks for the reply.

Searches not being immediately updated with new data is an expected behavior for me but you could have it documented for others

Anyway, somewhere else in the forum it is mentioned that you can think of workflows as functions. In that sense you could have them return a value. Yes “Return to parent workflow” could be a potential solution.

You are mentioning the workaround of saving the newly-created item on the page which poses a greater issue for the way Bubble is going to evolve.
In programming terms Bubble statements are functional and I believe this is the way that it should remain.
On the other hand if you see that there is no other way than to support “saving temporary a value somewhere” then this is called a variable and Bubble could consider supporting variables explicitly inside the workflow.

As a personal preference I like that Bubble does not offer hackerish solutions in general and I am not sure if variables should be supported at all. Alternatively users could have the options of blocks inside the workflow where you could insert hand-written source code (for example javascript) to implement complex logic when Bubble is not sufficient. The latter is merely an idea.
Let me know what are you thoughts on the above. Thanks a lot

Yes, I prefer functional solutions as well and I think returning a value is the cleanest way of solving this. This fits in with another project we’re working on in the near future so we might do this sooner rather than later.

I do think some concept of state is necessary for web applications, which is why we support (and will always support) attaching data to elements, so the workaround I suggested will always be supported. However, I agree that this is a bit of an abuse of that mechanism, since this state isn’t really relevant to a particular element.

We are certainly going to support writing custom javascript. We’re making a deliberate decision to defer building this for a while, though, because we want Bubble’s functionality to stay accessible without having to learn another language, so we don’t want “write some javascript” to become our default solution for corner-cases. Also, we want our internal APIs to become a bit more stable before we expose them to users.

I’ve got the same limitation as Pligor explained. I need some updates in custom workflows in reusable element to be done before calculations start.

If I use his exemple, wouldn’t it be possible to force the Event1 to be completely finished before the second action of the worflow starts ? An option like “Complete this event before continuing the worflow” for the Trigger Event1 action maybe ?

@pligor Have you tried the workaround Josh gave ? Saving the intermediate results in the Custom States did solve your issue ?
If this works, this is a quite important workaround to the my Bubble’s logic view.

@josh If I’ve got Action 1 > CustomEvent > Action 4 (with CE => Action 2 > Action 3), as a non-developer user I would expect to be able to call the “Results of Workflow” triggered by the CustomEvent. But it may not be as easy to code it seems.
I’ve got quite long workflows with sometimes different branches. But I note that sometimes calculations of the Action 3 are well finished before Action 4 starts, whereas sometimes they are not ! This is a huge uncertainty for an app which aims to calculate the amount the user will have to pay…

Here an idea,

In a similar way than “Trigger a workflow when data changes”, couldn’t we trigger a new workflow when an Element’s Custom State or Element’s Thing is changed ?

Then following my previous exemple I would have :

1/ Action 1 > CustomEvent (as for most action, it would imply changing a thing on my page)

2/ and only when this thing has changed, Trigger Action4. So I would be sure the data I need is available