Bubble creating "thing" before it gets to the creation step in the workflow

I’m working on a project that requires me to enter in people’s information as clients. For this I have to search the client database and make sure there are no existing clients with this information already (email, mobile number). I have the client database completely cleared, and I have a check prior to creating the client to make sure there is no client record with this information, and despite the database being empty, it says that a client with this record exists. When I run this through the debugger, it looks like it is creating the client record as soon as I click the button, and not when it reaches the create a client step in the workflow. Has anyone run into this problem before?

Hi there, @jgordon… I do a similar check in a couple of my apps, and I have never run into anything like that. Can you share a screenshot or two of your workflow? Are you terminating the workflow prior to the creation step if the client already exists?

Best…
Mike

Sure thing @mikeloc ,


This is the workflow for the button click. The highlighted parts in order are a check to see if the client exists, a step to create the client if it does not exist, and the step after that was a custom workflow I trigger to do the same thing. Initially I thought it was doing something weird because it was in a custom workflow so I pulled that step out into the main workflow.

This is the database for my client object, which I emptied prior to testing this workflow

This is the part in the workflow where I check to see if the client exists. The first thing this custom workflow does is check to see if there is an existing client by checking the total number of clients with the input email combined with the list of clients with the input mobile number value and checking if it is 0. Despite the database being cleared the creation of a client object not being reached yet in the workflow, this check still fails and says there is a client.

This is the very next step where it checks the same values, and if they are greater than 0 it sets the check to “no” as in no this client is not new.

This part of the workflow says it cannot create a client object because a client object with this information exists, but there is no possible way that could be true at this point because this is the first and only instance of a client object getting created.

As you can see here in the database there is now a single client record despite it saying it could not create a record.

I am running a termination check prior to this, but it is to see if this information is being used for a user object instead. Sorry for the screenshot spam, I hope this helps.

Hmm, my first thought is why not simplify the whole thing? I’m not sure I follow exactly what’s happening in your workflow, but you could literally have a single step that creates the client only when the count of clients with the input email plus clients with the input mobile number is 0. Do you need multiple checks and a custom state for a particular reason?

For reference (and only because it works), in my apps, I have a workflow step that shows an alert only when a duplicate count is greater than 0, and the next step terminates the workflow using the same only when condition that triggers the alert. The step after that creates the new thing without any only when conditions because that step can only be reached if the workflow can get past the termination step (i.e., if the duplicate count is 0).

The reason I have it so complex is because there are other places in the app where clients get created of different types, so instead of re-inventing the wheel over and over again whenever I need to create a client record I have a reusable with a custom workflow to check if it exists so every subsequent action based on that workflow can be triggered from 1 custom workflow that needs 1 only when.

I played around with your suggestion of putting the check right on the creation of the client record. I put a terminate workflow step right before it and even with the database cleared, it is still making a client record. At this point I think this might be a bug.

Yeah, that definitely sounds odd. Well, if you think it could help to have a second set of eyes on it, I’d be happy to take a look at your editor. Shoot a link via direct message if that sounds good… no worries if not.

Best…
Mike

I would appreciate that, but unfortunately this is not my application and I don’t know if my boss would want me to share the editor. I appreciate the help though, if I figure anything out I’ll let you know.

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