"Create if the thing doesn't exist"

Hi, I’ve been using a shopping cart from Airdev see: https://widgets.airdev.co/widget/1472621296515x898289732169359900

So, right now I’m having problem since Bubble changed “Create if thing doesn’t exsist yay/nay”

“Warning: This option has been deprecated on Jul 18, 2017. Applications created after this date will not be able to access it (but it will still be applied in run mode). Instead, users can use a condition on the action and create the thing if it does not exist in an action prior to the Change Thing action. We recommend users using this optoin to follow the same pattern as they upgrade their apps.”

basically I do not understand how that work’s. Can someone help me out a little, so I can get my shopping cart working properly again.

Thanks.

1 Like

I assume you created your app after Jul 18, 2017? If so, then this is the suggested workflow:

If a button is clicked (for example), add these two actions:

  1. Create a new Thing only when Thing does not exist (you could do a constrained search: “Search for Things [with constraints] :count is 0”)
  2. Make a change to a Thing only when Thing exists (same search: “Search for Things :count > 0”)

That way only one of those actions will ever run, either some Thing gets created or some Thing gets updated.


Gaby | Coaching Bubble
Private coaching, courses, and tons of free resources

9 Likes

Im not sure if its just me but when I run a workflow on a list I often get SOME multiple creations. I do a if (search for item =0) create the item, yet I get doubles for some items and not for others

Hey Chad, ran in the same problem yesterday, when putting items on a list. Changed the “=0” (zero) to “isn’t in”
worked like a charm.

I’ll have to give it a go, the item the item is in is being breathed in the same workflow so I put it down to the api call being made before the parent item existed

Hello @romanmg

I noticed this solution makes my app really slow as the whole database needs to be checked every time. That is if I have to check every time with the condition create the thing ONLY WHEN search for thing count = 0, I think searching the database like this is slow. It makes my app take about 7 seconds to complete.
Is there any other way to make the condition faster?

2 Likes

But why, just why? This makes workflows so cluttered and makes no sense.

4 Likes

This still works the same? it really doesn’t make sense since it adds so much work…