Hello! I’m experiencing an issue where my workflows made with Custom Events are not executing in the expected sequence. I have a process for creating a session that involves two validation steps before the session is actually created. However, Bubble seems to execute the “Create Session” step before completing the validation steps.
Expected Workflow:
Button Clicked → Triggers “Check for Duplicates”.
Custom Event: “Check for Duplicates”
If a duplicate is found (count > 0), show an error and terminate workflow.
If no duplicate is found, trigger “Check for Overlaps”.
Custom Event: “Check for Overlaps”
If an overlapping session exists (count > 0), show an error and terminate workflow.
If no overlap is found, trigger “Create Session”.
Custom Event: “Create Session”
Only executes if called from “Check for Overlaps”.
Creates the session and shows a success message.
The Problem:
Even when a duplicate or an overlapping session is found, Bubble still creates the session.
I added “Terminate this workflow” in both validation events, but it doesn’t stop the execution.
I tried using Custom States (can_create_session = Yes/No), but this didn’t help—when updating the state, Bubble immediately creates the session before completing the validations.
I also tested removing all unnecessary workflow steps and only triggering events in sequence, but it still misfires.
What I Need Help With:
Ensuring that Bubble does not execute the “Create Session” step unless all validations pass.
Understanding why Terminate this workflow is not stopping execution within Custom Events.
Confirming if there is an internal Bubble behavior that might be causing workflows to run in parallel instead of sequentially.
I’ve tested multiple approaches, but none seem to solve the issue. I would appreciate some help!
Conditions to execute the Terminate this workflow actions and those for invoking Custom Events (CEs) are mutually exclusive, so the fact that the process keeps invoking the next CE is not in contradiction with the Terminate this workflow actions not being executed.
The problem here seems to be that the invocation of CEs is apparently firing when it shouldn’t. So, we should have a look at the conditional allowing to invoke the CEs.
Can you confirm that the condition evaluates to something you don’t expect?
I didn’t know about the “Terminate this Workflow” behaivour. Thank you.
The conditions are not the problem. They behave as expected if I delete de CE “Create Session NP”. The problem is that the session is created before anything else, and it makes everything to fail.
Debugging step by step everything follows the woorkflow as it should, but the problem is that as the session is created at first (for some reason I don’t know).
Workflow actions on the front-end shouldn’t run asynchronously so I don’t think that’s the problem.
What are the search parameters on this action? It could be that this action is failing to set it to yes
Search for Sessions:count is 0
If I understand, you have the same condition here, it could be either your Search for Sessions:count is 0 is not set up properly, or your Group Widget Nueva sesion NP's Crear Sesion is yes is actually no
The ‘Set State’ is not changing nothing, actually. If I delete it, it will run the same way. I just put it in order to add another conditional, but it does not works.
The problem is when there is the action “Create a Session”. When I put it, it will be created before anything else.
Only when Search for Sesions:count > 0 is the condition that detects duplicates. If there is another session that has the same information as the one that is being created, then shows an alert and should end the workflow (or in that case, should not pass to the next CE).
Right now, when the bug happens it is evaluating: Only when Search for Sesions:count > 0 as True
and Only when Search for Sesions:count is 0 as False, but just from the CEVerificar Duplicados, because once evaluates it as False, the Workflow ends.
In order to create the session:
The Only when Search for Sesions:count > 0 condition from both CE should be False
and
The Only when Search for Sesions:count is 0 condition from both CE should be True.
In order to verify we are dealing with a bug, try placing a couple Text elements on screen that show the results of both conditionals, with exact same constraints for the Search for expressions.
If they return this below, and the Sesion gets created, we are seeing a normal behaviour, no bug.
If we see this, and the Sesion gets created, then it’s a bug.
Sorry, but I did not understand exactly how to do that.
In case it is useful, I did a video where you can see how the session is created before anything else. If not, could you explain me exactly what to do, please? Thanks!
Definitely looks odd, I would go back through your server logs from 3:00-3:02 and see what action triggered to create the item in the DB, it could be firing from another action that’s not included in your custom event, otherwise it might be a bug.
But that weird execution is triggering the alerts. Then when someone is creating a session, always will appear the alert “That session was not created because is a duplicate”.
from a programming point of view instead of nesting your workflows like that, create your 3 workflows and have them each return a value (return a value step is hard to find so just type return when you are creating the step).
have the top level work flow call the first one (which will have a value) then the second one only if the first step condition was met. Then the third one only of the original conditions are met.
In general your custom event should take parameters and return values rather than pulling in information from all over the place. This keeps the workflow tidy and allows you to test it more easily.