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
}
}
The short answer to this is: just use the Sub-item ID.
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:
Sorry, I failed to deliver on my promise! I actually ended up going down a different path and asked for Integromat support’s help. It’s been done with a series of modules linked to each other. It is a working solution, but I imagine it would be much more simple to just write a code for it. I did not have the time to keep trying that avenue unfortunately. I can share what Integromat modules were used if you’re interested.
This to me is a good foundation for code that can expand to other things that I have been waiting for in subitems. While I have used the Delete subitem automation with custom automations there are a few things I want to see through and possibly find my own work around for. That includes the following:
Change all subitem dates according to the change in the parent item
Change all subitem {column} that matches {column} in the parent item
Really I think that this is a good foundation to get the subitems to the full capability that I find useful in many cases, and I would love to have a solution for these common issues.
I dunno, I started writing the code into a GraphQL module on Integromat and it started throwing errors when I run it. I had no idea how to resolve those and after a couple of tries I just lost my patience. Went to Integromat’s helpdesk for advice and they’ve helped me with solving the problem with modules, not code.
Webhooks gets triggered when the status of an item changes to something. (I have a Monday automation that changes the status of the main item if the status of a subitem changes.)
I get all the respective subitems (since subitems are a separate board or something) listed by the next module.
The Iterator takes all the subitems from the subitems board into an Array.
Not really sure of why there was a need for a Get an Item module but it’s placed after the Iterator.
There’s a filter in place between the Get an Item and the Delete or Archive an Item module that makes sure only those subitems get deleted that are part of the parent item that triggered the Webhook.