Subitems Column Id

Hi Community,

How to get subitems id columns in the playground

any suggestions.

hi @Jorgemolina

I guess this requires a 2-step approach.

Step-1: query your board to get all columns in with:

{
  boards(ids: 123456789) {
    columns {
      id
      type
      setting_str
    }
  }
}

Now in you code (example is JS) get the columnId of the subitems column from the returned boards array from above (in my case called boardColumns) with:

  if (!boardColumns) return res.status(406).json({ error: "configuration error" });
  var subitemIndex = boardColumns.findIndex((el) => el.type == "subtasks");
  if (subitemIndex == -1) return res.status(406).json({ error: "configuration error" });
  var columnProperties = JSON.parse(boardColumns[subitemIndex].settings_str);
  var subBoardId = columnProperties.boardIds[0];

Now you have the boardId where your subitems are stored and you can use that to query it’s columns.

Hi BasdeBruin, Thanks for your reply. i could not make it with that query, however, I manage to get them from the following query:

query { boards(ids: 2304755136) {
    items (ids:2304780325) {
    subitems  {
      column_values {
        id
      }
    }
  }
}
}

The problem i am facing now is that i am receiving from the payload the subitem id and cannot find how to get with the query the column values of this subitem without the parent item id.

Yes, your query is using is using the (newer) subitems field. The problem I have with that one is that you require an itemId and in my use case that is not known. The query you show is also more expensive than just query the columns, fine the subitems column and get the setting_str

Are you referring to a payload you received form a webhook that triggers on subitem creation? In that case it is even easier as the payload will contain the boardId of the board where the subitems live. So you can get the columns from that board.

I will try to fig this one out - getting the board of subitems in the payload.

Thank you for your help - it is really appreciate it.