Delete parent and related object at once

would appreciate your help.

I am trying to make a server code to delete an object with its related object at once, to avoid doing it on client side, but I am not able to do it from Codeless. Can you please help me with that?

So I am trying to create a service, where I pass id of a parent object and it creates a transaction, where it removes parent object and related object. So, as an example, I have Shop table with address field which relates to Address table.

I cannot find related object in Address table by having only parent object id. How can I do that?

Thanks a lot,

I have a few questions and a comment for you:

  1. In your post you’re referencing the Shop table, however, the codeless logic creates a transaction with operations for the Address and the Property tables. Please clarify what table is the parent and which one is the related table.
  2. Is the id parameter you pass the objectId of an object in the parent table?
  3. The codeless logic is quite wrong. Rather than adding “Delete Table Object” blocks to the transaction, you need to add operations to it. Specifically for your use case, the operation is this:

    Once operations are added to a transaction, you need to run the transaction using the following block:


1 Like

Hey Mark, thanks for your quick reply and sorry for unclear question.

So basically what I am trying to do,

I would like to delete Property and Address objects in one transaction having only Property objectId.
I was trying to follow docs to create a transaction as you said, but its not going well for me, I cannot find Set(set MyTx) from this page Transaction API - Backendless Codeless Development Guide.
Screen Shot 2021-10-27 at 2.53.00 PM

Thanks a lot for your help!

Okay, I did some progress. The only thing I am missing is how to get address related object from Find operation and pass it to delete operation in transaction. Get property is not working.

Would appreciate any hint, thanks!

Okay, finally did it, had to get parent object first, save it to a variable and then add two delete operations to a transaction. Thanks for your help, have a great day!

Hi Nike,

This is how I would go about it:

The first Bulk Delete uses a where clause query that identifies the parent object. It will delete all objects that match the query, but there should be only one parent based on your schema.

The second Delete operation deletes the Address object identified by the argument value.