Complex query using boolean operators
The complex query syntax that can be used to retrieve custom object records through the List records for a custom object API operation.
Custom object query currently supports the AND (&&), OR (||) and NOT (!) operators. Note that the operators are case-sensitive. You must use uppercase.
AND
-
Search for custom fields data whose
statusisactiveandactiveDateis less than2018.
orstatus:active AND activeDate:<2018status:active && activeDate:<2018
OR
-
Search for custom fields data whose
statusisactiveoractiveDateis less than2018.
orstatus:active OR activeDate:<2018status:active || activeDate:<2018
NOT
-
Search for custom fields data whose
statusis missing orstatushas a null value.
or!_exists_:statusNOT _exists_:status -
Search for custom fields data whose
statusis notactive(statusis either missing or null).
or!status:active
Note that to search for custom fields data whereNOT status:activestatusexists and its value not equal toactive, use_exists_:status AND !status:active. -
Search for custom fields data with field
activeDateno less than2018(includingactiveDateis missing or null).
or!activeDate:<2018
Note that to search for custom fields data whereNOT activeDate:<2018activeDateexists and its value is no less than2018, use_exists_:activeDate AND !activeDate:<2018.
Deal with the null value
The null value fields cannot be distinguished from the missing fields. Therefore, when querying by the existence of a field, it only returns the records that contain the field and the field value is not null. Query by the non-existence of one field will return the records that either miss this field or have a null value in this field.