Querying leads with null field values

Anonymous
Not applicable

Querying leads with null field values

Is there a way to do a query through the rest api to return a set of leads that have no value in a specified field?  In results, the returned value will be null, like "firstName" : null.  However, when I send a query like "filterType=fieldName&filterValues=null",  it does not return the leads whose value in the specified field is empty, it returns the leads whose value in the specified field is literally the word "null".

"filterType=fieldName&filterValues=" also does returns an error, because filter values wants a value.

2 REPLIES 2
Devraj_Grewal
Level 10 - Champion Alumni

Re: Querying leads with null field values

Thomas,

Have you tried creating a smart list and bringing in the filter "First Name: is empty"?

SanfordWhiteman
Level 10 - Community Moderator

Re: Querying leads with null field values

This has been asked before, and the conclusion was there's no matching syntax AFAIK.

BUT... this search may well be doomed anyway. You can't match on more than 1000 items and a field like firstName typically has low cardinality: just searched one of my small instances and 10% of the leads (22K) have no First Name.  Of course that does depend on the maturity/management of your instance.

Also, when posting in the future you should mention [a] that you're using the API, not the UI and [b] which API endpoint(s) you're using.