Skip to navigation

Complex query using boolean operators

View as Markdown

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 status is active and activeDate is less than 2018.

    status:active AND activeDate:<2018

    or

    status:active && activeDate:<2018

OR

  • Search for custom fields data whose status is active or activeDate is less than 2018.

    status:active OR activeDate:<2018

    or

    status:active || activeDate:<2018

NOT

  • Search for custom fields data whose status is missing or status has a null value.

    !_exists_:status

    or

    NOT _exists_:status
  • Search for custom fields data whose status is not active ( status is either missing or null).

    !status:active

    or

    NOT status:active

    Note that to search for custom fields data where status exists and its value not equal to active , use _exists_:status AND !status:active.

  • Search for custom fields data with field activeDate no less than 2018 (including activeDate is missing or null).

    !activeDate:<2018

    or

    NOT activeDate:<2018

    Note that to search for custom fields data where activeDate exists and its value is no less than 2018 , 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.