Create vs Upsert in a transaction — different result reference?

We are trying to construct a transaction which

  1. creates or updates an object in a table (so we would like to use “Upsert” block), and
  2. adds relations to this object

But the transaction fails when the object to be upserted does not contain an objectId, the error info is:

code: 25016
message: "Unable to perform 'SET_RELATION' operation due to argument incompatibility. The operation references a result from another 'UPSERT' operation. The specified result cannot be obtained from this operation (objectId)."

However, when replacing the Upsert block with a Create block, the transaction runs just fine.

How is this possible? I thought Upsert would create an object in the database just as if we were using the Create operation block, and the operation result reference would contain the object that is being created (with objectId). But apparently not?

Below is the code we have… as you can see, the disabled block (Upsert) has exactly the same inputs as the enabled block (Create). But things fail when Upsert is enabled, Create is disabled.

Hello @Alex_Klein

I was able to reproduce the problem. I opened a ticket for the team to investigate and fix the problem.

Regards,
Vladimir

1 Like

Thank you — seems like a very fundamental issue… good luck!

For quick fix you can change OpResult from upsert operation to OpResultValueReference with objectId from upsert operation:

Regards,
Vladimir

Works. Thank you @Volodymyr_Ialovyi