Solved

How to findCards that have some value on a field and also are in a specific phase?

  • 1 August 2022
  • 2 replies
  • 388 views

Userlevel 1

Hi, I´m new here, and I need to find all cards that have that field value, but also just return the ones in a specif phase. How can I do that?

 

My query looks like that:  findCards(    pipeId: "301593112"    search: {fieldId: "placa", fieldValue: "HJD3B23"} )

 

 

icon

Best answer by Lucas Democh 1 August 2022, 15:00

View original

2 replies

Userlevel 7
Badge +15

Hello @Inmo Tecnologia,

It is currently not possible to filter the phase in Pipefy queries.

A workaround is for you to create a field that will be updated with the phase name at each phase change.

So, you can add the filter to the content of this field with the name of the phase you want to filter.

 

A second, slightly more complex option is to use the Phases endpoint.

In this query, you inform the phase ID and get all the cards in the queried phase as a return.

You would have to do a treatment to be able to cross the two queries and filter only the cards that are in the two queries (Left Join).

 

The phase query can be done like this:

{
phase(id: 12345){
id
name
cards_count
fields {
id
label
}
cards{
edges{
node{
id
}
}
}
}
}

 

Userlevel 7
Badge +12

I agree with Lucas, either you introduce an auxilary field you search for, or you do the filtering manually in your code, either for the correct phase or the correct field value, whatever requires less cards to load.

Reply