Creates a query to retrieve a list of contacts.
The queryContacts()
function builds a query to retrieve a list of contacts
and returns a
ContactsQueryBuilder
object.
The returned object contains the query definition,
which is typically used to run the query using the
find()
function.
You can refine the query
by chaining ContactsQueryBuilder
functions onto the query.
ContactsQueryBuilder
functions enable you to sort, filter,
and control the results queryContacts()
returns.
queryContacts()
runs with these ContactsQueryBuilder
defaults,
which you can override:
The functions that are chained to queryContacts()
are applied in the order they are called.
For example, if you apply ascending('info.company')
and then descending('info.name.last')
,
the results are sorted first by the company name, and then,
if there are multiple results with the same company,
the items are sorted by last name.
Note:
Only visitors with
Manage Contacts permissions
can query contacts.
You can override the permissions by setting the suppressAuth
option to true
in the find()
function.
For property support for filters and sorting, see Query contacts: Supported filters, sorting, and search.