function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
efantiniefantini 

How to query an empty reference

Dear all

how is  possible to query if a reference field is empty (using soql)?

I tried to use:

- where refID = ''

- where refID = null

but it doesn't work.

I saw that in salesforce is possible to create a view that retrieve what I want, simpy chosing my reference field, selecting "equal to" and left the third field empty.

Which is the query used by SalesForce to retrieve my data?

Thanks for your support

DevAngelDevAngel

Hi enfanti,

Where refId = null should work.  I have tested this on string/text fields and double fields.  What is the field type of refId?

efantiniefantini
The type of my field is "reference" (Id) 
DevAngelDevAngel

Hi enfanti,

Hmm, this may be a bug.  I'll check further and report findings.