Set Relations to table entry

I am trying to save a form that fills information on my main table and then set 2 relations. One is a 1:1 and the other is 1:N. The main table saves just fine but the relations throw errors. The most common error when trying things out is Error: Child Id must be provided and must be a string.
I cannot figure out how to create this all at once.

Here is the DB:

And here is what I am trying to do. I am trying to stay 100% codeless
image

Each object in the list of objects you add here should have the objectId property. This is what’s causing the error - the server doesn’t know which specific object in the database to add as a child:
Codeless Set Relations to table entry - mark@backendless.com - Backendless.com Mail 2022-08-25 10-58-45

Hmmm ok. Can you help me understand what each section of that block represents? Let me know where I go wrong…
table name: the name of the table that i am trying to add to the parent
parent object: the object id of the parent i want to assign the table to
relation name: the column within the parent i want this to go to
children: the data that goes with the table that i put in table name

I know this is wrong, but can you please correct which part?

  • table name - name of the table where the parent object is stored
  • parent object - identifies the object that will be getting new children
  • relation name - name of the relation column that will be getting new children
  • a collection of child objects that are already stored in another table. The children will be added to the relation identified by relation name for the object identified by parent object. To identify the specific child objects, the objectId property for each child in the children collection must be present.

Here’s the API doc for the underlying API used by the codeless block in question: Add Relation with objects - Backendless SDK for JavaScript API Documentation

Hope this helps.

Regards,
Mark

1 Like

Ah thank you so much! I didn’t realize that I need to make the entry in the child tables before adding them. This is what my final looked like

This looks like a major overkill to me. You should be able to save it all in a single shot with 1 Deep Save block. Create one object with a complete closure - meaning the object that will have objectId as the primary property and then all the children you need to save. And then use Deep Save for that object. As a result, child objects will be created and relations established.

Oh i guess the list thing threw me off the first time for the 1:N relation and thought I had to do all of that. Thank you!
image