Deleting subitems

Hello there,

First post in the developer section.
I’m trying to figure out how to write a code in GraphQL for deleting subitems.

I’m reading this description (Items) and I note this quote “Using this board ID and subitem ID you can apply any action to the subitem as you would to a regular item (i.e. archive it, delete, change column_values, etc).” and it’s not clear to me what syntax I’d have to use to delete (not to create) a sub item (not an item).
Would it be something like this:

mutation {
    delete_subitem (parent_item_id: 1234567, item_name: "subitem to be deleted") {
        id
        board {
            id
        }
    }
}

or something like this with the parent item id inserted somewhere?

mutation {
    delete_item (item_id: 12345678) {
        id
    }
}
1 Like

Hey @iszabo ,

That’s a great question!

The short answer to this is: just use the Sub-item ID. :slight_smile:

To put this into perspective, any Sub-item board in a monday.com account is just like any other board. You can see the items and columns of that sub-item board, and those can be separate from the Parent/Main item board.

When querying a Board, you can get all of the Items and Sub-item IDs:

Then, you can just use the sub-item ID in order to delete it:

Does that make more sense? Let us know :slight_smile:

-Alex

I think it does and thank you for taking the time to answer. I’ll have a crack at this and report back.

1 Like

@iszabo

Awesome :slight_smile: I’ll be keeping my fingers crossed, but if you have any further questions on this, just let us know.

-ALex