APIs & Integrations

JSteinshouer
Member

GraphQL filter with OR not working

Hello. I am new to GraphQL so I am likley not doing something the correct way. I am trying to query to filter results using the OR operation. Here is my query but it does not return any results. 

 

query MyQuery {
CRM {
contact_collection(limit: 10, filter: {phone__eq: "555-555-5555", OR: {my_custom_property__eq: "123456"}}) {
...
}

If I do this then I get a result. 

query MyQuery {
CRM {
contact_collection(limit: 10, filter: {phone__eq: "555-555-5555"}) {
...
}

I am not sure what I am doing wrong but any help is greatly appreciated.

0 Upvotes
1 Reply 1
Jaycee_Lewis
Community Manager
Community Manager

GraphQL filter with OR not working

Hey, @JSteinshouer 👋 I hope you got this worked out. If not, have you tried setting up your OR operator like this?

query MyQuery {
  CRM {
    contact_collection(limit: 10, filter: { 
      _or: [
        { phone__eq: "555-555-5555" },
        { my_custom_property__eq: "123456" }
      ]
    }) {
      ...
    }
  }
}

 

Best,

Jaycee


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes