queryExtendedFields( )


Creates a query to retrieve a list of extended fields.

The queryExtendedFields() function builds a query to retrieve a list of extended fields and returns an ExtendedFieldsQueryBuilder object.

The returned object contains the query definition, which is used to run the query using the find() function.

You can refine the query by chaining ExtendedFieldsQueryBuilder functions onto the query. ExtendedFieldsQueryBuilder functions enable you to control the results queryExtendedFields() returns.

queryExtendedFields() runs with these ExtendedFieldsQueryBuilder defaults, which you can override:

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

Supported Query Filters

The following ExtendedFieldsQueryBuilder filters are supported for queryExtendedFields().

For a full description of the ExtendedField object, see ExtendedFieldsQueryResult items.

PropertySupported Sorting                                                            
_createdDateascending(), descending()
_updatedDateascending(), descending()
displayNameascending(), descending()
Method Declaration
Copy
function queryExtendedFields(): ExtendedFieldsQueryBuilder;
Request
This method does not take any parameters
Returns
Retrieve all extended fields
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myQueryExtendedFieldsFunction = webMethod( Permissions.Anyone, async (options) => { try { const queryResults = contacts.queryExtendedFields().find(options); const items = queryResults.items; const firstItem = items[0]; const pageSize = queryResults.pageSize; const hasNext = queryResults.hasNext(); const hasPrev = queryResults.hasPrev(); const length = queryResults.length; const query = queryResults.query; return items; } catch (error) { console.error(error); // Handle the error } }, ); /* Returns items: * [ * { * "_createdDate": "2021-03-30T12:41:13.000Z", * "_updatedDate": "2021-03-30T12:41:13.000Z", * "displayName": "Event we met at", * "key": "custom.event-we-met-at", * "dataType": "TEXT", * "namespace": "custom", * "fieldType": "USER_DEFINED" * }, * { * "_createdDate": "2021-01-19T23:18:17.000Z", * "_updatedDate": "2021-01-19T23:18:17.000Z", * "displayName": "Last Contacted", * "key": "custom.last-contacted", * "dataType": "DATE", * "namespace": "custom", * "fieldType": "USER_DEFINED" * }, * { * "_createdDate": "2021-01-17T18:42:31.000Z", * "_updatedDate": "2021-01-17T18:42:31.000Z", * "displayName": "Patronus", * "key": "custom.patronus", * "dataType": "TEXT", * "namespace": "custom", * "fieldType": "USER_DEFINED" * }, * { * "displayName": "Display Name (start with first)", * "key": "contacts.displayByFirstName", * "description": "Display name starting with first name (read only)", * "dataType": "TEXT", * "namespace": "contacts", * "fieldType": "SYSTEM" * }, * { * "displayName": "Display Name (start with last)", * "key": "contacts.displayByLastName", * "description": "Display name starting with last name (read only)", * "dataType": "TEXT", * "namespace": "contacts", * "fieldType": "SYSTEM" * }, * { * "displayName": "VAT ID", * "key": "invoices.vatId", * "description": "Vat ID for Wix Invoices", * "dataType": "TEXT", * "namespace": "invoices", * "fieldType": "SYSTEM" * }, * { * "displayName": "Membership Status", * "key": "members.membershipStatus", * "description": "APPROVED/DENIED/PENDING/INACTIVE (read only)", * "dataType": "TEXT", * "namespace": "members", * "fieldType": "SYSTEM" * }, * { * "displayName": "Mobile flag", * "key": "members.mobile", * "description": "true/false", * "dataType": "TEXT", * "namespace": "members", * "fieldType": "SYSTEM" * }, * { * "displayName": "# of Purchases", * "key": "ecom.numOfPurchases", * "description": "Wix Stores purchase count (read only)", * "dataType": "NUMBER", * "namespace": "ecom", * "fieldType": "SYSTEM" * }, * { * "displayName": "Total Spent Amount", * "key": "ecom.totalSpentAmount", * "description": "Wix Stores aggregated spent amount (read only)", * "dataType": "NUMBER", * "namespace": "ecom", * "fieldType": "SYSTEM" * }, * { * "displayName": "Total Spent Currency", * "key": "ecom.totalSpentCurrency", * "description": "Wix Stores currency code (read only)", * "dataType": "TEXT", * "namespace": "ecom", * "fieldType": "SYSTEM" * }, * { * "displayName": "Last Purchase Date", * "key": "ecom.lastPurchaseDate", * "description": "Wix Stores last purchase date (read only)", * "dataType": "DATE", * "namespace": "ecom", * "fieldType": "SYSTEM" * }, * { * "displayName": "Effective Subscription Status", * "key": "emailSubscriptions.subscriptionStatus", * "description": "SUBSCRIBED/UNSUBSCRIBED/NOT_SET/PENDING (read only)", * "dataType": "TEXT", * "namespace": "emailSubscriptions", * "fieldType": "SYSTEM" * }, * { * "displayName": "Effective Deliverability Status", * "key": "emailSubscriptions.deliverabilityStatus", * "description": "VALID/BOUNCED/SPAM_COMPLAINT/INACTIVE (read only)", * "dataType": "TEXT", * "namespace": "emailSubscriptions", * "fieldType": "SYSTEM" * }, * { * "displayName": "Effective Email", * "key": "emailSubscriptions.effectiveEmail", * "description": "Effective Email for subscription purposes (read only)", * "dataType": "TEXT", * "namespace": "emailSubscriptions", * "fieldType": "SYSTEM" * } * ] */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?