Query Subitems based on Name

Hey Everyone,

I’m somewhat new to Monday.com and recently have automated out Onboarding process to automatically duplicate a template group and name it based on the new hire name. As a part of the automation every time an items is completed the automation looks for the group name, than the items and marks it as done. (see query code below.) however when trying to do the same for subitems within the group i keep getting errors. I have the board ID, Parent Item ID, and Group name.

Here is the query i have so far:

query {
      boards(ids: ${boardId}) {
        items(ids: ${parentItemId}) {
          subitems(query_params: {
            rules: [
              {
                column_id: "name",
                operator: "contains_text",
                value: "${itemName}"
              }
            ]
          }) {
            id
            column_values {
              id
              text
            }
          }
        }
      }
    }

And here is the query i’m using for regular items (that works well)

query {
      boards(ids: ${boardId}) {
        items_page(query_params: {
          rules: [
            { column_id: "group", compare_value: "${groupName}", operator: contains_text },
            { column_id: "name", compare_value: "${itemName}", operator: contains_text }
          ],
          operator: and
        }) {
          items {
            id
            name
          }
        }
      }
    }

I’m not sure what i’m missing here. thank you for the help.

Daniel

Hi @danielh

Welcome to the community! The query_params is only available on the items_page, not on subitems. What you possibly can do is to get the boardId of the board where the subitems live and handle the subitems as normal items there (including the items_page and query_params).