Skip to main content
Solved

Get child pipes in pipe query

  • February 9, 2022
  • 1 reply
  • 216 views

Tegrus
  • Regular Participant
  • 4 replies

I can’t get information about the child/parent pipes in Pipe query. I make a query like this one below:

{
  pipe(id: "form id here") {
    childrenRelations {
      child {
        __typename
      }
    }
  }
}

And the only property I can get from the child/parent is __typename and the result is this:

{
  "data": {
    "pipe": {
      "childrenRelations": [
        {
          "child": {
            "__typename": "Pipe"
          }
        }
      ]
    }
  }
}

I want to know at least the child pipe ID. I tried the pipe_relations query, but it has the same limitations. The only way I could get some information about the pipes in the relations was in card query, but I need that information before a card is created.

Best answer by genietim

I suggest looking into some GraphQL tricks. As is the case in GraphQL, in your query, you specify what you want the result to contain. Now, the problem in this query arises as the entry could be of different types. In this case, there is the trick to use `… on {Typename} {...what you want from this type}`, which lets you specify separately what you want for the different types.

E.g. a query like the following could return the child pipe and database ID:

{
  pipe(id: "form id here") {
    childrenRelations {
      child {
        __typename
                ... on Pipe { id }
                ... on Table { id }
      }
    }
  }
}

 

View original
Did this topic help you find an answer to your question?

1 reply

genietim
Forum|alt.badge.img+12
  • Pipefy Legend
  • 412 replies
  • Answer
  • February 11, 2022

I suggest looking into some GraphQL tricks. As is the case in GraphQL, in your query, you specify what you want the result to contain. Now, the problem in this query arises as the entry could be of different types. In this case, there is the trick to use `… on {Typename} {...what you want from this type}`, which lets you specify separately what you want for the different types.

E.g. a query like the following could return the child pipe and database ID:

{
  pipe(id: "form id here") {
    childrenRelations {
      child {
        __typename
                ... on Pipe { id }
                ... on Table { id }
      }
    }
  }
}

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings