Backendless Support
 
Answered

Adding Child Object with reference to Parent Table.

Hi, I have two tables 'CommentThreads' and 'HelpComments'. 'CommentThreads' have a list of 'HelpComments' objects in it, now I want to add data in 'HelpComments' table, how can I add new child object and set the parentId?

As far as I know, I have to save new 'HelpComment' object in the database then I can add the new comment's object in 'CommentThreads' table. But for this, I have to call Backendless Data Services three times, First to create the new comment. then to retrieve 'CommentThreads' object and then to update 'CommentThreads' object after adding the new comment in it.

Can I do the same in a single API call or better than the above mentioned?

Leave a Comment

Comments (7)

photo
1

Waiting for reply.

photo
1

Hello,

do you use backendless 4.0 ?

photo
1

No, I'm using backendless 3

photo
1

You can retrieve 'CommentThreads' object with relations to 'HelpComment', then create HelpComment, add it to CommentThreads, save CommentThreads

photo
1

So, I can't save HelpComment's object and set parent object of the saved HelpComment's object ?

photo
1

no, you can not

photo
1

Thanks :)