Query syntax of custom object records
The query syntax for retrieving custom object records through the API.
You can use the List records for a custom object API operation to query custom object records. You can define your query through the q query parameter of this operation.
Complex Query Using Boolean Operators
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.status:active AND activeDate:<2018orstatus:active && activeDate:<2018
OR
-
Search for custom fields data whose
statusisactiveoractiveDateis less than2018.status:active OR activeDate:<2018orstatus:active || activeDate:<2018
NOT
-
Search for custom fields data whose
statusis missing orstatushas a null value.!_exists_:statusorNOT _exists_:status -
Search for custom fields data whose
statusis notactive(statusis either missing or null).!status:activeorNOT status:activeNote : To search for custom fields data wherestatusexists 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).!activeDate:<2018orNOT activeDate:<2018Note : To search for custom fields data whereactiveDateexists 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.