Only When and Terminate This Workflow aren't working as expected

Hi Bubblers,

I’ve setup a number of actions in a workflow to prevent a duplicate record from being entered based on three fields. However, for some reason it does not seem to work.

Here’s how it goes:

Note: Please disregard Step 1 and 2 (They both work perfectly fine)

Step 3 (Doesn’t work) - Show Message/Alert - Show “Must not post duplicate user services” if an existing record of User Service is found based on three fields (User ID, Service Category, Service Type)

Step 4 (Doesn’t work) - Terminate this workflow - Terminate this workflow if an existing record of User Service is found based on three fields (User ID, Service Category, Service Type)

Step 5 (This works) - Create a new record - Create a new User Service if an existing record of User Service IS NOT found based on three fields (User ID, Service Category, Service Type)

Step 6 (Does not work - the workflow never reaches this step) - Go to the next page - send current page parameters + Send more parameters

Here’s the output:

UI - Does not let users progress past this page and keeps showing the duplicate alert even though there isn’t any records in the database

Database’s state Before (Starting Point)

Database’s state After - Record is created but the workflow terminates and does not let users progress past this page

What am I doing wrong here?

Hi there, @arsedian.ivan… I could be way off base here, but having :first item in those expressions doesn’t seem right to me. Instead of :first item is not empty, have you tried :count > 0? I’m not sure if that’s the issue, but it can’t hurt to give it a shot.

Best…
Mike

Edit: oh, wait… I guess you do need :first item if you are using is not empty. I just always go with :count.

Hi @mikeloc yes I have tried both (using count and first item) none of them work strangely. I will post some screenshots of the count shortly

Got any privacy rules in place that might be getting in the way?

No, I’ve intentionally set them all as publicly visible during the development.

I am also seeing the same issue - did you ever reach a solution?

I am also facing the same problem. I can see in the step-by-step debbuger that the “terminate this workflow” works (condition is true), but the next step (“create a new thing”) is also executed, as I can see that new thing in the database, although the step-by-step didn’t show that. Is that a Bubble bug?

A couple of years later, I’m guessing OP was running into a workflow execution (order of operations) issue, and this Bubble quick tip contains important information I wish I had known when I started using Bubble many years ago.

1 Like

Hey @app17,

I decided to break this up at the top level rather than within the steps.

So, essentially, I have multiple ‘WHEN Button Next Step is Clicked’, and each one has its own unique ‘ONLY WHEN’ condition. Instead of having multiple steps each with an ‘ONLY WHEN’ condition.

1 Like