> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: queryExtendedFields() # Method package: wixCrmBackend # Method menu location: wixCrmBackend --> Contacts --> queryExtendedFields # Method Link: https://dev.wix.com/docs/velo/apis/wix-crm-backend/contacts/query-extended-fields.md # Method Description: 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`](wix-crm-backend/contacts/extended-fields-query-builder/introduction) object. The returned object contains the query definition, which is used to run the query using the [`find()`](wix-crm-backend/contacts/extended-fields-query-builder/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: - [`skip(0)`](wix-crm-backend/contacts/extended-fields-query-builder/skip) - [`limit(50)`](wix-crm-backend/contacts/extended-fields-query-builder/limit) - [`descending("_createdDate")`](wix-crm-backend/contacts/extended-fields-query-builder/descending) > **Note:** > Only visitors with > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions) > can query extended fields. > You can override the permissions by setting the `suppressAuth` option to `true` > in the [`find()`](wix-crm-backend/contacts/extended-fields-query-builder/find) function. #### Supported Query Filters The following `ExtendedFieldsQueryBuilder` filters are supported for `queryExtendedFields()`. For a full description of the `ExtendedField` object, see [`ExtendedFieldsQueryResult`](wix-crm-backend/contacts/extended-fields-query-result/introduction) [`items`](wix-crm-backend/contacts/extended-fields-query-result/items). | Property | Supported Sorting                                                             | | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `_createdDate` | [`ascending()`](wix-crm-backend/contacts/extended-fields-query-builder/ascending), [`descending()`](wix-crm-backend/contacts/extended-fields-query-builder/descending) | | `_updatedDate` | [`ascending()`](wix-crm-backend/contacts/extended-fields-query-builder/ascending), [`descending()`](wix-crm-backend/contacts/extended-fields-query-builder/descending) | | `displayName` | [`ascending()`](wix-crm-backend/contacts/extended-fields-query-builder/ascending), [`descending()`](wix-crm-backend/contacts/extended-fields-query-builder/descending) | # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## 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" * } * ] */ ``` ---