Using Upsert function when you don't know the objectId ahead of time

Hi All,

My use case is that I have a sign up for for a brand where I want to create a new object if the brand is new or reuse the object if the Brand already exists in the app. This sounds like a good candidate for upsert.

My problem is that I don’t know the objectId from the begining- Instead I’m trying to set up a WHERE clause that will look for an appropriate objectId based off of the brand name that was submitted, set that output as a variable, and then update it with the information that was provided. However the following logic is throwing off the below error.

Are there any documents on upsert outside of the youtube video that was published this week that might help me understand what needs to be done here?

“Load table objects” returns a list.

You take that list and wrap it into another list and call the result BrandObjectId. That doesn’t make sense.

What you should do is get the first element from the list returned by Load Table objects and extract the objectId property from it.

Thanks Mark is that as simple as just removing the create list block in my logic? I think I’m probably overthinking how to extract the objectId

No, you need to get the first object from the list returned by “Load Table objects” and from that object get the objectId property value.

Thanks Mark- I’m afraid I’m still not grasping something here.

Here’s what I think the logic should be
A) Use a where clause to only return back objectId’s in my “Load Table objects” block
B) Set this list as a variable so that I can use the “In list get first” logic

D) Use a nested “get property” and “In list get first logic” inside my upsert

I’ve tried a few variations of the above (setting the list as a variable vs nesting like this) and am getting a different error calling for objects to be returned as an array of objects.

Appreciate any ideas

The problem is right here:

The argument says “objects” (plural). The argument you are passing is a single object, but it must a list. All bulk operations expect a collection of objects.

Ah gotcha- thank you for that clarification. Swapping out Bulk Upsert to standard upsert works as expected