Using Search API to get deals

Hi all, I’m using the “/crm/v3/objects/deals/search” endpoint to get a list of deals. I need to put 4 filters (all of them with AND).

  1. Company name X
  2. Deal isn’t closed
  3. Project ID is unknown
  4. Close date is between specific dates

I know there’s a limitation of maximum three filterGroups with up to three filters in each group and this is becoming an issue for me.

I’ve put the first three filters in a filtergroup and the next one as a separate filtergroup. Is there a way to use AND between two filter groups or some other way that’d allow me to put the filters mentioned above?

Hi, @asmmlkmblive :waving_hand: To confirm, you are not missing a documented solution. I agree, being able to “chain” AND statements would be useful. And in this case, it is not possible.

Hey, @louischausse @MatthiasWeber @coldrickjack, do you have any creative solutions for the problem @asmmlkmblive is trying to solve?

My instinct is that you’ll need to break this into pieces on way or another.

You could try to:

  • make your request using the three filters in one group
  • add the fourth as a property to be returned
  • filter the “filter as property” externally (Middleware or a simple server could work) and then send the results to their destination

Or make two calls:

  • the first would use three of your filters in a group
  • the second would be your fourth filter
  • it will take some investigation to understand which filters to group and which to send solo to get the most efficient results
  • handle the final sorting and matching on your end via your app or Middleware of your choosing

I know this isn’t what you were asking for. And I hope it helps light a creative spark and get you unstuck and onto the next step.

Best,

Jaycee

Hey Jaycee, thanks for responding.

Yeah, I figured out it wasn’t possible, so I created a workflow that handles the filtering part and sets a new ‘custom property’ to 1 or 0. I used that in my API call, and it worked.

Cheers!

Hey, @asmmlkmblive :waving_hand: I appreciate you letting us know how you solved your challenge. I didn’t think of doing it that way. Thanks for teaching me a new trick!

Have fun building! — Jaycee