Forum Academy Marketplace Showcase Pricing Features

Update thing; if it doesn't exist, create it

what’s the current recommended approach to handle this kind of situation?
“update thing; if it doesn’t exist, create it”

currently I have two actions in my workflow for create/update with a condition, but if the id of the created/updated object is needed later on in the flow, I struggle to return one ID or the other conditionnally because the ‘format as text’ doesn’t return an object but text… and this kind of problem can easily scale up in the same flow…

Thanks for your insight!

The day we get format as Thing will be glorious

I just use two actions with conditionals, not sure if there’s a better solution.

I currently have something like:

Step 1
Update thing A…

Step 2 (if step 1’s thing is empty)
Create thing A…

Step 3
update thing B
parent_thingA = Search for thing A where unique Id = (step 1’s thing A is empty? if yes step 2 unique id, if no step 1 unique id) : first item


Don’t do a search here (it won’t work).

Just update Thing B with the results of Step 2 (only if results of step 2 is not empty)


I wrote a mistake in my previous message which I just updated.

I need the search to conditionally apparent the thing B to either the existing thing A updated in step 1 or the newly created thing A created in step 2.

If I don’t use the search I need two actions.

Why not just create a thing if the thing doesn’t exist (check this using a DB search) and make changes to the already existing thing (find it using a search) if result of step 1 is empty

yes that’s what I’m doing, I guess I was not clear in my answer?
I do create or update based on the record A existing or not, but then I need two actions to handle the option where the record already existed, and where it didn’t (or one action with my approach with the search).

though my original question was if there would be a better way to handle the “if it exists, update, if not create” but I guess not at the moment.

thank you guys.

Hi Axel, personally I’d use 2 different workflows for this as that’s just how I like to structure my workflows.

However, you could simplify your flow and avoid a new search altogether as follows:

This might save you some Workload Units overtime :wink:


Thanks, that’s a nifty approach!

1 Like

@axel.duheme Actually, this approach works but is more expensive regarding Workload Units. I created a LinkedIn post about it where we dive into the metrics. Feel free to check it out here: Olivier Coolen on LinkedIn: #bubble #nocode #lowcode #visualprogramming #software

Hello Olivier ! Thanks a lot for sharing the experiment you did with us, I just read it. :slight_smile:

Some feedback, I don’t think test one and two are completely equivalent because in scenario 1 you create a thing, in scenario 2 you create or update a thing, then update it again!

A fairer test in my opinion would be to also add the update (3rd step from scenario 2) to the scenario 1.
Moreover in a real use case the 3rd step wouldn’t be necessary, because we can already make the necessary changes in step 1 and 2.

In the case I was presenting earlier, the thing that needs updating in the last step of the flow is a child record “B” of thing “A” (whose reference we get from step 1 or 2).

1 Like

Yes exactly, there are always more options to structuring something, this was just one example. I should have made that more clear in my LI post. Thanks for the feedback tho! :grinning_face_with_smiling_eyes: