descending( )


Adds a sort to a query, sorting by the specified properties in descending order.

The descending() function refines a ExtendedFieldsQueryBuilder to sort in ascending order of the specified properties. If you specify more than one property, descending() sorts the results in descending order by each property in the order they are listed.

You can sort the following types:

  • Number: Sorts numerically.
  • Date: Sorts by date and time.
  • String: Sorts lexicographically, so "abc" comes after "XYZ".

If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items that do not have a value for the specified sort property are ranked lowest.

Method Declaration
Copy
Method Parameters
propertyNameArray<string>Required

The properties used in the sort.

Supported properties:

  • _createdDate
  • _updatedDate
  • displayName
Returns
JavaScript
Did this help?

find( )


Returns the items that match the query.

The find() function returns a Promise that resolves to the results found by the query and some information about the results. The Promise is rejected if find() is called with incorrect permissions or if any of the functions used to refine the query are invalid.

Note: Only visitors with Manage Contacts permissions can query extended fields. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
Method Parameters
optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<ExtendedFieldsQueryResult>
JavaScript
Did this help?

limit( )


Limits the number of items the query returns.

The limit() function defines the number of results a query returns in each page. Only one page of results is retrieved at a time. The next() and prev() functions are used to navigate the pages of a query result.

By default, limit is set to 50.

The maximum value that limit() can accept is 1000.

Method Declaration
Copy
Method Parameters
limitstringRequired

Limit the number of items to return, which is also the pageSize of the results object.

Returns
JavaScript
Did this help?

skip( )


Sets the number of items to skip before returning query results.

The skip() function defines the number of results to skip in the query results before returning new query results.

For example, if you query your contacts and 50 items match your query, but you set skip to 10, the results returned will skip the first 10 items that match and return the 11th through 50th items.

By default, skip is set to 0.

Method Declaration
Copy
function skip(skip: string): ExtendedFieldsQueryBuilder;
Method Parameters
skipstringRequired

The number of items to skip in the query results before returning the results.

Returns
JavaScript
const query = contacts.queryExtendedFields().skip(10);
Did this help?