Skip to main content

Mutation Subitems column value

  • December 20, 2023
  • 4 replies
  • 337 views

Hi,
I am trying to mutate multiple column values from a subitem with this query:
mutation {
change_multiple_column_values(
item_id: subitemId
board_id: boardId
create_labels_if_missing:true
column_values: “{"text": "New text", "status": "Done"}”
) {
id
}
}

i get:

{
“error_code”: “ResourceNotFoundException”,
“status_code”: 404,
“error_message”: “Item not found in board”,
“error_data”: {
“resource_type”: “item”,
“item_id”: 5719698167,
“pulse_id”: 5719698167,
“board_id”: 5702744956,
“error_reason”: null
}
}
I’m not sure if this is the correct way to change the column values, or if I should provide the column values when creating the subitem (I also don’t know how this would be done).

How can I make this?

4 replies

  • Participating Frequently
  • December 20, 2023

Are you using the subitem board id, or the primary board ID? Subitems actually exist on a separate board from the main board that’s hidden.

you may need to query the item for {items(ids: subitemId){board{id}} first to get the subitem board.

Another method is when creating the subitem instead of just returning the {id} instead return {id,board{id}} which will give you the board it was created on.

However, when creating a subitem, you can provide column values as JSON (you need to take your column values object and stringify it as JSON before using it in your query, and also escape quotes in that. Or look into graphql variables which will let you avoid the whole having to ensure everything is properly escaped. Setting the values on creation may not trigger column all change automations though, if you want to trigger column change automations do it in a separate query.

monday API docs

  • Author
  • New Participant
  • December 20, 2023

Thank you very much!!!
Knowing that, I have easily solved it.
What I can’t understand is why subitems are assigned a different board ID…


  • Participating Frequently
  • December 20, 2023

Because the subitems require a different board structure (columns, their types, titles, etc.) so they used a separate board entirely for it. There is then a linked_items structure on each item that covers all the connected boards including subitems. The UI then displays those items under each item as subitems.

a little over simplified.


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • December 27, 2023

Thank you @anon29275264 for the help!