For anyone building anything to do with accounting in Bubble we could also use transactions where everything rolls back if the entire operation is not successful
What about sequential Custom events that contain backend workflows? Will Custom event #2 wait for all of Custom event #1’s backend workflows to complete first? (If so, how does it know?)
I have a long workflow which contains backend workflows. I want to display a loading spinner that disappears once the entire workflow has completed. Would the following achieve this?
show “popup loading” > run backend workflow 1 > run backend workflow 2 > trigger custom event = hide “popup loading”
This topic was automatically closed after 70 days. New replies are no longer allowed.
This is GOLD to know. I have been running in circles trying to reference data that doesn’t seem to exist yet
Did you get an answer to this question? it appears that the backend workflow triggers after the result from step x completes but i was wondering if this was ever confirmed.
Confirmed. This is one of the ways to achieve order of operations. At the very least the action whose execution depends on a prior result will not trigger until it receives its expected value.
darn i was just here. wish id known this 2 weeks ago
This has been hugely helpful for me and, generally, great advice. That said, I am running into an issue that cuts against the grain of some of these assumptions, and I’m hoping you might have an explanation. I have a custom event that (essentially) runs conditionally, based on the value of a custom state. I toggle the state to “yes” (using a second custom event) before triggering this custom event and then toggle it to “no” (using a third custom event) after it has completed. Given this structure, where each step is wrapped inside a custom event, I would expect each one to run synchronously, as outlined above. That said, this is not what is happening. Instead, the workflow is getting hung up in infinite loops. It seems like everything does work as expected when using the debugger, so I know the logic is sound. It’s just that the workflow does not seem to be waiting for the custom event to complete before moving on to the next one. Can you explain this?
Yours and @aaronsheldon’s points would seem to be very important ones that deserve being highlighted in the OG post, since most folks rely on plugins. I’m currently facing this issue myself and has left me scratching my head.
Hey @ts11 - I assume that the “Loading Shapes” state is the state you’re toggling with the “Set Loading State” steps? And that one of these is setting the state to yes and the next is setting it to no (it kind of doesn’t matter which).
I don’t know anything about the What3Words plugin, but it looks like you’re referencing some exposed state “A marker has been drawn”. I can only assume that this goes high once and stays there. I think you’re expecting it to be a triggered event instead?
Anyway (if what I describe above is the situation), if “A marker has been drawn” is just a state that is always high after some point, you’re causing that “When What3Words” workflow to trigger infinitely simply by toggling “Loading State”.
Every time it goes from yes to no this workflow will trigger. So it’s essentially just triggering itself over and over and over and…
This would work properly if there were some explicit triggered event triggering this workflow (which may or may not need the additional conditions as its “only when” condition).
Thanks so much for jumping in here, Keith, and apologies for the rather lack-luster explanation of my setup. Yes to the synopsis of the “Loading Shapes” state. However, that “marker has been drawn” event is actually raised each time a new marker is drawn on a map. I think I solved the issue by moving the condition from a state to a field on the map record and playing around with my order of operations. I think the problem was ultimately with one of my custom events, where the “draw shape” actions were placed before a custom event to toggle that “shapes loading” variable. I ended up moving the state change to a “schedule custom event” step to ensure a delay between the drawing of the shapes and the changing of the variable.
Clear as mud, I’m sure. At any rate, it works! (For now)
But further to your other comment, @ts11, I do find that, in some cases the approach of grouping sets of actions into a Custom Event and then having a workflow composed solely of Custom Events in some sequence, does not always achieve what is desired.
Specifically, one place I ran into this is with the Floppy element (from my Floppy browser storage and stuff plugin collection), which even though its various data manipulation actions are synchronous with respect to each other (and with respect to certain native Bubble actions like Set State), it seems that it was impossible to make them synchronous with respect to actions like “Create/Make Changes to a Thing”.
Now, there are complex reasons that Floppy might behave this way (so this shouldn’t be taken as a general comment on plugins), but I introduced a feature (“Sync Triggers”) that can be used to abso-defo-lutely be sure that some Floppy action is fully complete before moving on to some action that stubbornly refuses to wait.
I talk about this stuff in a rather off-the-cuff video here:
I’ll have to take a look at this!
They’ll probably be a part 2 as well, but I was kind of in a hurry. At any rate, I don’t show every single-dingle permutation of what one might try, but in this particular case, no sensible approach works besides listening for a specific event triggered by the plugin.
(Also, wrt your workflow picture - the way Bubble auto-labels workflows makes it kinda hard to understand if something is a state or a trigger, so I don’t feel like you were being lazy there! But I was like: well, if that’s a state, I see an infinite loop here. That exact situation is another reason that I really want the Client-side Actions API to be able to return values to the workflow, because that would make it possible to have “in workflow” states that only exist within the context of the workflow and wouldn’t cause potential loops.)
Does anyone know what is the order of operations in case of backend workflows? I mean if there are step1, step2 etc within a backend workflow then would they run in sequence or the logic mentioned by @aschofer is valid for backend workflows too?
What @aschofer mentioned and so is in the documentation is that the logic given is only applicable to “frontend workflows”, hence the confusion.
- 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.
Could someone please confirm this is actually correct? I only ask because on the pause action in bubble, it says that it is will only affect graphical elements and not data & variables etc… so just wanted to clarify.
Some more clarifications here.
Say, we have a backend workflow that has a few steps like this
Action 1 → Action 2 → Action 3 → Custom Event 1 → Custom Event 2 → Action 4 → Schedule API1 → Action 5 → Custom Event 3
Here, I understand that Action 1, 2, 3 can run in parallel. However, is there a guarantee that Custom event 1 will run only after action 1, 2,3 are done?
Is there a guarantee that Action 4 will run only after Custom Event 2 has run?
Is there a guarantee that Schedule API1 will happen only after Custom Event 2 is run?
Is there a guarantee that Custom Event 3 will run only after all other operations are done?
Here based on my understanding: @mghatiya
I for a button to just tell an action wait for another list of actions to complete