Solved

[GraphQL] Can I filter cards by custom field values?

  • 4 January 2021
  • 2 replies
  • 314 views

Userlevel 1

I’ve seen here (https://developers.pipefy.com/changelog/new-graphql-feature-query-cards-by-updated_at) that we can filter cards by using built-in field liks update_at.

 

How can I filter my cards by a custom field? Let’s say i have a field called “customer_id”. I tried this but didnt get it to work:

 

query allCardUpdatedYesterday { allCards(first: 20, pipeId: 123,filter: { field: "customer_id", operator: equal, value: "87y8-b7a6b-8a6c"}) { edges { node { id title } } } }

 

Do I have to prefix the field id with something?

 

The response I get does not add much:

 

{
  "data": {
    "allCards": null
  },
  "errors": [
    {
      "message": "Something went wrong",
      "locations": [
        {
          "line": 18,
          "column": 3
        }
      ],
      "path": [
        "allCards"
      ],
      "code": 30000,
      "type": "ExecutionError"
    }
  ]
}

icon

Best answer by Marcos Carvalho 6 January 2021, 14:10

View original

2 replies

Userlevel 5
Badge +6

Hey @brennomaeji , 

 

Unfortunately it’s not possible to filter by fields in the allCards query. 

 

The only filter available is the updated_at filter, like this:

{
allCards(pipeId: 576018, first:5 filter: {field: "updated_at", operator: gte, value: "2019-04-02T00:00:00-00:00" AND:[{field: "updated_at", operator: lte, value: "2019-04-03T00:00:00-00:00"}]}) {
edges {
node {
id
title
}
}
pageInfo {
hasNextPage
endCursor
}
}
}

 

 

But if you want, the Cards query has more options: 

 



 

Hope it helps you :slight_smile:

Concordo que seria incrível se pudéssemos filtrar por custom field

I agree it would be amazing if we could filter by custom field 

Reply