Solved

Get the late cards from a sprecific pipe using GraphQL

  • 13 March 2023
  • 6 replies
  • 216 views

Userlevel 3
Badge

Hey everyone! I’m trying to get all the late cards from a specific pipe. At the moment, i’m using this code here, that gives me all the cards from the pipe and then, on my editor, i filter the late ones:

{allCards(pipeId: XXXXXXXX, first: 50) 
  {pageInfo {
    hasNextPage
    endCursor
  }
    edges {
      node {
        id
        late
        current_phase{
          id}
      }
    }
  }
}

 

Is there a way that i can get only the late cards? Like a request that only returns the late cards, an their respectives id and current phase?

icon

Best answer by marcosmelo 13 March 2023, 20:44

View original

6 replies

Userlevel 7
Badge +18

Hey everyone! I’m trying to get all the late cards from a specific pipe. At the moment, i’m using this code here, that gives me all the cards from the pipe and then, on my editor, i filter the late ones:

{allCards(pipeId: XXXXXXXX, first: 50) 
  {pageInfo {
    hasNextPage
    endCursor
  }
    edges {
      node {
        id
        late
        current_phase{
          id}
      }
    }
  }
}

 

Is there a way that i can get only the late cards? Like a request that only returns the late cards, an their respectives id and current phase?



Hello, @contato1705 

The following code fetches the specified phase and returns only late cards

Check if its helps

 

{

    phase(id: "xxxxxxxxxx") {
    name
    cards {
        edges {
          node {
            id
            title
            late
           
            }
          
            }
          }
        }
      }
    

Userlevel 7
Badge +12

The answer by @marcosmelo does not do what you want, @contato1705 . It only lists the cards of a specific phase, without limit on whether they are late or not.

What should be possible instead is to use the https://api-docs.pipefy.com/reference/queries/#allCards allCards query with the filter, where you filter for the date.

I currently do not have the necessary tools available, but I will add another answer later with the actual query I would suggest.

Userlevel 7
Badge +18

Thanks for contributing, @genietim !

Userlevel 7
Badge +12

As promised, here an example query using the advanced search to query to the due date:

 

query {
allCards(pipeId: <yourPipeId>, filter: {
field: "due_date",
operator: lte,
value: "2023-03-14T00:00:00-02:00"
}) {
edges {
node {
id title late
fields {
name
value
}
}
}
}
}

 

that should solve your problem, no?

Userlevel 7
Badge +12

(thank you too, @marcosmelo , sorry if my answer was a bit too dismissive as I realise now, and sorry if I understood something wrong anyway)

Userlevel 7
Badge +18

Don't worry, @genietim

Tks!!

Reply