Nested Linked Items

Hi All hope you are well

First time posting so bare with me, im working on a project that basically just needs to pull the information from monday.com into a kind of client portal so people can log into their account on my clients website and see where things are in the fulfilment pipeline.

Its a basic use of the api whilst a lot of work has gone into the actual data in monday.com

Onto my question

The client has three boards:- one for tasks, one for accounts(businesses) and one for contacts (list of contacts at said businesses), these are all linked daisy chain style task β†’ business β†’ contact using a connect boards column

I had tried to nest the related items but that maxed out the depth of the api, so i decided to split it into two calls

one for the tasks with the associated businesses
one for the business with the associated contacts

The issue i have now is trying to merge these together, is there a way to do so, maybe theres something i can do differently in my main query so i dont need to, any help would be much appreciated

Query for the contacts linked to the businesses board

{
  boards(ids: 1221726149) {
    items_page(limit: 100) {
      items {
        id
        name
        column_values {
          column {
            id
            title
          }
          id
          type
          text
        }
        linked_items(
          linked_board_id: 1221726147
          link_to_item_column_id: "account_contact"
        ) {
          name
          column_values {
            column {
              id
              title
            }
            id
            type
            text
          }
        }
      }
    }
  }
}

Query for the tasks linked to the businesses

{
  boards(ids: 1221726138) {
    items_page(limit: 1) {
      items {
        id
        name
        column_values {
          column {
            id
            title
          }
          id
          type
          text
        }
        linked_items(
          linked_board_id: 1221726149
          link_to_item_column_id: "connect_boards6"
        ) {
          name
          column_values {
            column {
              id
              title
            }
            id
            type
            text
          }
        }
      }
    }
  }
}

Hello there @tomncurry and welcome to the community!

I hope you like it here :muscle:

I am not sure I understand the question. I think I understand the scenario, but what do you want to do with the data? What would a β€œmerge” look like?

Looking forward to hearing from you :slightly_smiling_face:

Cheers,
Matias

1 Like

Hi Matias hope you are well, thanks for getting back to me,

So in terms of a merge I want the contacts to be displayed inside the company array

In my original comment i mentioned i had tried to linked items to contacts inside the link items to companies but the array was too deep.

I need to go from my seperate queries of:

  • task β†’ company
  • company β†’ contact

simply to:

  • task β†’ company β†’ contact

Let me know if this makes any sense

Thanks

Tom

Hello again @tomncurry,

I am very sorry for the late reply!

I still do not follow what you mean.

Please fill this form with your script and a screen recording explaining the flow you want to achieve and someone from our team will take a look into it :grin:

Cheers,
Matias