Introduction

When you execute a query with the find() function, it returns a Promise that resolves to a ExtendedFieldsQueryResult object. This object contains the items that match the query, information about the query itself, and functions for paging through the query results.

Did this help?

items


itemsArray<ExtendedField>Read-only

Returns the items that match the query.

The current page of items retrieved by the query.

List of extended fields.

Note: When no items match the query, the items array is empty.

To paginate your query results, use the ExtendedFieldsQueryResult pagination properties and functions.

Perform a query and get the returned items from the result
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const getQueryResultItems = webMethod(Permissions.Anyone, () => { return contacts .queryExtendedFields() .limit(10) .find() .then((results) => { if (results.items.length > 0) { return results.items; } else { console.log("No items found"); } }) .catch((error) => { console.error(error); }); }); /* items: * [ * { * "_createdDate": "2021-03-30T12:41:13.000Z", * "dataType": "TEXT", * "displayName": "Event we met at", * "fieldType": "USER_DEFINED", * "key": "custom.event-we-met-at", * "namespace": "custom", * "_updatedDate": "2021-03-30T12:41:13.000Z" * }, * { * "_createdDate": "2021-01-19T23:18:17.000Z", * "dataType": "DATE", * "displayName": "Last Contacted", * "fieldType": "USER_DEFINED", * "key": "custom.last-contacted", * "namespace": "custom", * "_updatedDate": "2021-01-19T23:18:17.000Z" * }, * { * "dataType": "TEXT", * "description": "Display name starting with last name (read only)", * "displayName": "Display Name (start with last)", * "fieldType": "SYSTEM", * "key": "contacts.displayByLastName", * "namespace": "contacts" * }, * { * "dataType": "TEXT", * "description": "Vat ID for Wix Invoices", * "displayName": "VAT ID", * "fieldType": "SYSTEM", * "key": "invoices.vatId", * "namespace": "invoices" * }, * { * "dataType": "TEXT", * "description": "APPROVED/DENIED/PENDING/INACTIVE (read only)", * "displayName": "Membership Status", * "fieldType": "SYSTEM", * "key": "members.membershipStatus", * "namespace": "members" * }, * { * "dataType": "NUMBER", * "description": "Wix Stores purchase count (read only)", * "displayName": "# of Purchases", * "fieldType": "SYSTEM", * "key": "ecom.numOfPurchases", * "namespace": "ecom" * }, * { * "dataType": "NUMBER", * "description": "Wix Stores aggregated spent amount (read only)", * "displayName": "Total Spent Amount", * "fieldType": "SYSTEM", * "key": "ecom.totalSpentAmount", * "namespace": "ecom" * }, * { * "dataType": "TEXT", * "description": "Wix Stores currency code (read only)", * "displayName": "Total Spent Currency", * "fieldType": "SYSTEM", * "key": "ecom.totalSpentCurrency", * "namespace": "ecom" * }, * { * "dataType": "DATE", * "description": "Wix Stores last purchase date (read only)", * "displayName": "Last Purchase Date", * "fieldType": "SYSTEM", * "key": "ecom.lastPurchaseDate", * "namespace": "ecom" * }, * { * "dataType": "TEXT", * "description": "SUBSCRIBED/UNSUBSCRIBED/NOT_SET/PENDING (read only)", * "displayName": "Effective Subscription Status", * "fieldType": "SYSTEM", * "key": "emailSubscriptions.subscriptionStatus", * "namespace": "emailSubscriptions" * }, * { * "dataType": "TEXT", * "description": "VALID/BOUNCED/SPAM_COMPLAINT/INACTIVE (read only)", * "displayName": "Effective Deliverability Status", * "fieldType": "SYSTEM", * "key": "emailSubscriptions.deliverabilityStatus", * "namespace": "emailSubscriptions" * } * ] */
Did this help?

length


lengthnumberRead-only

Returns the number of items in the current results page.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

JavaScript
let resultLength = results.length; // 20
Did this help?

pageSize


pageSizenumberRead-only

Returns the query page size.

The page size is defined by the limit() function, can be retrieved using the pageSize property, and navigating through pages is done with the prev() and next() functions.

JavaScript
let resultPageSize = results.pageSize; // 50
Did this help?

query


Returns the ExtendedFieldsQueryBuilder object used to get the current results.

Use the query property to create and run a new query by chaining additional ExtendedFieldsQueryBuilder functions to it. You can filter only on properties that have not not already been used in the previous query.

JavaScript
let resultQuery = results.query;
Did this help?

hasNext( )


Indicates if the query has more results.

Method Declaration
Copy
function hasNext(): boolean;
Request
This method does not take any parameters
Returns
Return Type:boolean
JavaScript
let hasNext = results.hasNext(); // true
Did this help?