# Help with graphquery

**URL:** <https://community.prismic.io/t/help-with-graphquery/17912>\
**Category:** Developing with Prismic\
**Tags:** graphquery\
**Created:** [October 31, 2024, 11:00pm UTC](https://community.prismic.io/t/help-with-graphquery/17912 "2024-10-31T23:00:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tudor2004](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@tudor2004](https://community.prismic.io/u/tudor2004)\
**Post date:** [October 31, 2024, 11:00pm UTC](https://community.prismic.io/t/help-with-graphquery/17912/1 "2024-10-31T23:00:28Z")

</div>

I have the following query:

```auto
const home = await client.getSingle("homepage", {
    graphQuery: `
    {
      homepage {
        ...homepageFields
        slices {
          ...on boxes {
            variation {
              ...on default {
                primary {                  
                  ...primaryFields
                }
              }
            }
          }
        }
      }
    }
    `,
  });

  const boxes = home.data.slices.find((slice) => slice.slice_type === "boxes");

  console.log("boxes", boxes?.primary.items[0]);

```

This is the output that i get when running the above:

```auto
[next] boxes {
[next] title: 'Drept Societar și Comercial',
[next] description: 'Oferim consultanță companiilor în fiecare etapă a evoluției lor. Indiferent dacă ajutăm firme să pătrundă pe piața românească sau să se adapteze specificului juridic local, avem o înțelegere profundă a pieței și contextului de afaceri din România.',
[next] icon: 'gavel',
[next] page: {
[next] id: 'ZyP6GxEAAC4AOKt6',
[next] type: 'page',
[next] tags: [],
[next] lang: 'ro-ro',
[next] slug: 'drept-societar-si-comercial',
[next] first_publication_date: '2024-10-31T21:43:57+0000',
[next] last_publication_date: '2024-10-31T21:45:33+0000',
[next] uid: 'drept-societar-si-comercial',
[next] url: '/drept-societar-si-comercial',
[next] link_type: 'Document',
[next] isBroken: false
[next] }
[next] }

```

And here is the issue: I want to get additional data of the linked page. For example title and slices.

So what I tried was the following:

```auto
      homepage {
        ...homepageFields
        slices {
          ...on boxes {
            variation {
              ...on default {
                primary {
                  page {
                    ...pageFields
                  }
                }
              }
            }
          }
        }
      }
    }

```

But I get an error:

```auto
[next] Unable to find page in primary
[next] at async Index (page.tsx:50:18)

```

I tried every possible combination, I give up, I don't have a clue how to set this query up :(

---

<div class="post-metadata">

**Author:** ![nf\_mastroianni](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/nf_mastroianni/32/7071_2.png) [@nf\_mastroianni](https://community.prismic.io/u/nf_mastroianni)\
**Post date:** [November 2, 2024, 6:07pm UTC](https://community.prismic.io/t/help-with-graphquery/17912/2 "2024-11-02T18:07:31Z")

</div>

Not sure if this will help @tudor2004 but it's worth a shot. When I am pulling my hair out with graphQueries, I switch to fetchLinks to see if it gets me what I want. Once I see what happens there, I'll determine if it's worth it to me to use the graphQuery process.

Below is a graphQuery that works for me. The withSubMenu variation queries a document type of sub\_menu from which I pull its slices:

```auto
const layout = await client.getSingle('site_layout', {
    // fetchLinks: ['sub_menu.slices'], note this is here from when I pulled my hair out
    graphQuery: `
    {
      site_layout {
        call_label
        call_link
        logo
        slices {
          ...on menu_item {
            variation {
              ...on default {
                primary {
                  label
                  link
                }
              }
              ...on withSubMenu {
                primary {
                  label
                  sub_menu {
                    slices
                    slices1
                    slices2
                  }
                }
              }
            }
          }
        }
      }
    }
    `,
  })

```
