Looping Is Creating Duplicate Records

I’ve been seeing a new concern in a workflow that I thought I had resolved in the past; hoping this audience can help me identify where I need to change my implementation…

In short, I am importing data from a spreadsheet and my import process is attempting to normalize the data stored in the database. For example, if there is a “john smith” listed multiple times in the spreadsheet, I only want one “john smith” created and then related records associated to this one “john smith” recipient record.

I built the process sometime back and thought I had a solid running process (i.e. my logic works) in the past, however, my recent tests are not consistent; feels like something changed with execution handling of workflows in bubble or the number of records in our table is causing slower queries for conditional checks.

The first screenshot is the workflow that triggers the process; in workflow the concerning bit is occurring in “Trigger GetRecipient” custom event. When called, the Get Recipient Event (screenshot further down) should return a matching record if it exist or create a new recipient and return the record to the workflow.

When running through a loop of records in an import process, I will see that sometimes (50’ish %)this process works perfectly and other times the process is creating duplicate recipient records.

Is there a better way to implement a “create a new record, only when a match isn’t found” in a looping process? I thought by using Custom Events" for the record creation, Bubble would not have sequencing issues (i.e. parallel request processing vs sequential)

This is the custom event… The search logic in the conditions are correct and work as expected (when they work)

Hi @nilsobrien

Can you trigger the flow and document your logs. I’ve had issues with searches originating in the backend in recent days but I managed to resolve it.

My issue looked something like the attached. As you can see there seems to be a random ‘_LOOKUP_’ text embedded in the searched values unique_id which creates a mismatch. Still not sure what causes that because its not privacy rules, so although I’ve resolved the issue I’m still waiting on Bubble specialised team to explain this because the product specialist couldn’t.

Thank you @QinisoG … I see that in my logs, but those don’t seem to be related to the areas of operations that my process is having an issue with.

I just reviewed logs again and I agree. But as I said I had a fix, but I can’t explain why the fixed worked which is why I’m still waiting on Bubble.

Can you show me the fields you use to constrain the search for the records that get duplicated, or are there no constraints inside of the search?
Do you have multiple instances of ‘create a new thing’ for the duplicated records and if so where are those actions?

Its not entirely clear to me whether its a slow/mismatched search or whether you are unknowingly triggering multiple instances of the same action.