Are triggers in backend workflows executed asynchronous?

I have a backend workflow that triggers an event, which creates a database entry “A”. It appears to me, that this event is triggered asynchronous, because if I use that database entry “A” in another table by referencing it throughout the workflow, entries with empty columns are created, even though the entry “A” was created successfully.

If this is truly the case, then how do I work around this issue?

Hi @CosmicSelf,

This issue comes up often, and it’s pretty well documented. Also search the forums for “workflow execution”.

In short, if a step references the “Result of…” a prior step, then the result of that prior step is guaranteed to be available for the step that referenced it. IOW, the prior step(s) become a dependency.

3 Likes

Yes, workflow may run asynchronous. The best way to make it run step-by-step is:

  1. Make next step dependent of the firs step (like, the need to use some data or information of past actions). Or…

  2. Group parts of this workflow inside another workflow. When you have the action “Trigger another workflow” in your main workflow, Bubble will run all this “secondary workflow” before continue to run the main flow. Or…

  3. Put short pauses between the steps.

1 Like

Thank you for your responses. I tried to apply your suggestions, here are the results:

The option using a previous step as a reference in the “Result of…” does not work with triggering of custom events.

The option using a workflow instead has the downside, that I have to load the object needed from the database again, slowing down the process, because API objects can not be passed to workflows, for whatever reason.

Inserting short pauses is also not possible, because this feature is not available on backend workflows.

And for the option of referencing previous steps, according to the documentation it says:

“Retrieving a thing from “result of step X” where step X is the “Create…” step should always be safe.”

So then this means, that you can not use any reference to previous steps unless it is one that is creating something? And also it “should” be safe, but is not guaranteed?

This topic was automatically closed after 70 days. New replies are no longer allowed.