I am struggling on a sequence issue with one of my workflow (see the screenshot attached).
My issue is that whatever I try (events, no events, conditions on events, conditions on actions of the workflow), the event at step 4 is always executed before the event triggered at step 3 and this is messing up my workflow.
I watched a video from bubble officials that said that if there is an event in a workflow, all actions after that event will wait for the event to be finished. But in my case that is not true.
My Workflow is simple, what I want to do is: IF User is already attached to a specific thing THEN display a message ELSE attach it to this thing.
I tried at the beginning to have both actions in the same linear workflow but somehow the âattachâ action was executed before and the âdisplayâ message action was always executed⌠whatever the conditions that were on the actions.
Event in step 3 just displays a message in one visual alert, event in step 4 adds a thing (vendor) to another thing list (mandate).
I know that step 4 is triggered before step 3 because I have a text on my app that displays the content of the list dynamically and I see that way before the debugger comes to event 3 the element has already been added to the list so the condition for step 3 is always valid .
At the beginning I had that in the same workflow:
Step 3: trigger event when list contains my element vendor
Step 4: Trigger event when list doesnât contains my element vendor
At the beginning I had all the actions in one workflow with on each either one of those conditions:
Lists contains vendor
List doesnât contains vendor
But with all actions serialized the actions on database were always done first so âlist contains vendorâ was always true.
Then I added the events because in the official Bubble video (https://www.youtube.com/watch?v=IbhCrciOKHM) they say âif you run a custom event in step 2 of your workflow, all remaining actions will wait until the entire custom event workflow is completedâ â which I thought was perfect for me
Itâs so trivial what I want to do but I donât get it⌠I the user you try to add to the mandate already is in the mandate you display an error message. If itâs not in it then you add it.
I also tried to do these steps : 1) display error message if user exists â 2) terminate workflow if user exists â 3) add vendor if user doesnât exists but it was the same ----> if the user doesnât exist, it is added then I still get the error message from previous steps in the workflow
I have a workflow with 10 steps and am having sequencing issues⌠I used the debugger hoping to force sequence at least to see if my logic was correct and I just needed to address sequencing, but in the debugger Iâm paused on Step 3 and I looking at my database I can see Step 10 has already runâŚ
Whatâs the point of having âRun nextâ in the debugger if you canât even use it to isolate and control when each step is runâŚ
I even added 4x 10 second pauses at the places I am having issues, and even then my later steps still seem to be running before the 10 seconds is up (doesnât matter whether I am in debugger or notâŚ)
The debugger wonât help much here - it doesnât give a real-time representation of workflow actions - most of the actions seems to trigger in more or less real-time, even when the debugger is in step-by-step mode, so then it just steps through the actions even though most of them have actually already happened - so things like conditions (which have already been evaluated in reality) will show up completely wrong in the debugger.
And pauses only apply to client-side actions, so they are no good for slowing down server side actions in workflows.
Sorry I had my message blocked in my drafts apparently !!
So, I created a support ticket but didnât get so much help. After copying my app in a local environment, they observed that my guess was correct, second event is triggered before the first event. They recommended me whatâs already in the official video, using pause action or try to change my design. I already tested all of those things before going to the support of course. So I removed that part of my feature and I moved to another job.
Even synchronizing through custom states or sequence of events doesnât change a thing, event 2 always gets triggered first somehow. Unfortunately I encountered the same issue in a different context few weeks later. The way events and workflows are synchronized are somehow not glueing up with the official videos.
I thought this was a great idea to solve a problem I am having related to sequential workflows, but it does not work. The return data step will execute in parallel and immediately return done = yes thus triggering the other steps immediately as well.
I read through the thread. You had a very good Bubble dev picking it up and like he said it will be close to impossible to troubleshoot without knowing exactly how you have your WFs, conditions and datastructure setup. The screenshot of your WF actions wonât help.
I think youâre assuming that Bubble WFs happen in order? Bubble WF actions ONLY run in sequence for client-side actions. Backend actions and on a few occasions, conditions will not respect the WF order. Bubble actions are not synchronous,from what I understand they are mostly async and hence may run in parellel. Again depending on the action. You can find more details in Bubbleâs documentation.
You can overcome race conditions using custom events by requiring parameters and returning values. Alternatively you can build a plugin or use a Toolbox plugin element to write some JS to overcome some synchronous issues.
Though a proper review of your DB structure to suit your requirements is a better alternative.