How to update object with relation?

I cannot figure out how to update object with relation.This is how I try to do it.

It saves two different objects into table and column with relation is empty. Please, give me a hint.

Hi Nik,

the Set Object Relations block returns the number of child objects set into the relation. So you’re trying to pass this as an object to save into the EventIdeas table.
From your screenshot, it’s not quite clear what you’re trying to achieve. Could you please describe in more detail what exactly you would like to achieve?

Regards,
Stanislaw

I’m creating object EventIdea and I need to add to this object cityId related to SupportedCities table.

I would recommend you using the Deep Save API for your purpose. Please read the following article for the Deep Save API:

Well, I did how it described in documentation, two ways. And it asks me to provide objectId beforehand.
Looks like your documentation outdated.


Is this full logic inside the createNewEventForMe method or something is not shown on the screenshot? Looks like the error comes from a different block, not the Deep Save one.
You may also use the try/catch and print block to debug and test each step.
Please let me know if there is some logic below Deep Save block.


this is full logic

Thanks. Looks fine for me. I see you have some function Find user by objectId at the start of the method. Is it possible that the error comes from that function? If you put a print block right after set myProfile to Find user by objectId line, will you see it in the logs?

Ok. That was one problem, I needed to log in to get userId first. But still, Deep Save doesn’t do the work.

New object saved without relation to cities table.

If you log myProfile, do you see there a cityObject property? I guess it’s empty, and if so, you’ll need to specify that you want to load this relation in your Find user by objectId function.

Right! But I’m surprised because my user has a relation to the city. But it doesn’t load with “find user by”.
How do I get my user with city relation?

By default when loading records, their relations are not loaded. This was made for the performance.

How do I get my user with city relation?

I recommend you watching the following video:

Thanks. That works.
Now I expanded this logic to save two objects with Deep Save

and it tells me
400 - Action requires more operations in transaction than currently available (1320)

Is it a real technical limit or just a paywall limit for free account?

@mark-piller can you clarify this?

Deep Save uses transactions to persist the “object tree”. The error means the number of operations required in your case is more than what’s allowed by the pricing plan you’re on.