Search.../

queryExtendedFields( )

Creates a query to retrieve a list of extended fields.

Description

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()

Syntax

function queryExtendedFields(): ExtendedFieldsQueryBuilder

queryExtendedFields Parameters

This function does not take any parameters.

Returns

A ExtendedFieldsQueryBuilder object that contains the refined query.

Was this helpful?

Retrieve all extended fields

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { contacts } from 'wix-crm-backend';
3
4export const myQueryExtendedFieldsFunction = webMethod(Permissions.Anyone, async (options) => {
5 try {
6 const queryResults = contacts.queryExtendedFields().find(options);
7
8 const items = queryResults.items;
9 const firstItem = items[0];
10 const pageSize = queryResults.pageSize;
11 const hasNext = queryResults.hasNext();
12 const hasPrev = queryResults.hasPrev();
13 const length = queryResults.length;
14 const query = queryResults.query;
15
16 return items;
17 } catch (error) {
18 console.error(error);
19 // Handle the error
20 }
21});
22
23/* Returns items:
24 * [
25 * {
26 * "_createdDate": "2021-03-30T12:41:13.000Z",
27 * "_updatedDate": "2021-03-30T12:41:13.000Z",
28 * "displayName": "Event we met at",
29 * "key": "custom.event-we-met-at",
30 * "dataType": "TEXT",
31 * "namespace": "custom",
32 * "fieldType": "USER_DEFINED"
33 * },
34 * {
35 * "_createdDate": "2021-01-19T23:18:17.000Z",
36 * "_updatedDate": "2021-01-19T23:18:17.000Z",
37 * "displayName": "Last Contacted",
38 * "key": "custom.last-contacted",
39 * "dataType": "DATE",
40 * "namespace": "custom",
41 * "fieldType": "USER_DEFINED"
42 * },
43 * {
44 * "_createdDate": "2021-01-17T18:42:31.000Z",
45 * "_updatedDate": "2021-01-17T18:42:31.000Z",
46 * "displayName": "Patronus",
47 * "key": "custom.patronus",
48 * "dataType": "TEXT",
49 * "namespace": "custom",
50 * "fieldType": "USER_DEFINED"
51 * },
52 * {
53 * "displayName": "Display Name (start with first)",
54 * "key": "contacts.displayByFirstName",
55 * "description": "Display name starting with first name (read only)",
56 * "dataType": "TEXT",
57 * "namespace": "contacts",
58 * "fieldType": "SYSTEM"
59 * },
60 * {
61 * "displayName": "Display Name (start with last)",
62 * "key": "contacts.displayByLastName",
63 * "description": "Display name starting with last name (read only)",
64 * "dataType": "TEXT",
65 * "namespace": "contacts",
66 * "fieldType": "SYSTEM"
67 * },
68 * {
69 * "displayName": "VAT ID",
70 * "key": "invoices.vatId",
71 * "description": "Vat ID for Wix Invoices",
72 * "dataType": "TEXT",
73 * "namespace": "invoices",
74 * "fieldType": "SYSTEM"
75 * },
76 * {
77 * "displayName": "Membership Status",
78 * "key": "members.membershipStatus",
79 * "description": "APPROVED/DENIED/PENDING/INACTIVE (read only)",
80 * "dataType": "TEXT",
81 * "namespace": "members",
82 * "fieldType": "SYSTEM"
83 * },
84 * {
85 * "displayName": "Mobile flag",
86 * "key": "members.mobile",
87 * "description": "true/false",
88 * "dataType": "TEXT",
89 * "namespace": "members",
90 * "fieldType": "SYSTEM"
91 * },
92 * {
93 * "displayName": "# of Purchases",
94 * "key": "ecom.numOfPurchases",
95 * "description": "Wix Stores purchase count (read only)",
96 * "dataType": "NUMBER",
97 * "namespace": "ecom",
98 * "fieldType": "SYSTEM"
99 * },
100 * {
101 * "displayName": "Total Spent Amount",
102 * "key": "ecom.totalSpentAmount",
103 * "description": "Wix Stores aggregated spent amount (read only)",
104 * "dataType": "NUMBER",
105 * "namespace": "ecom",
106 * "fieldType": "SYSTEM"
107 * },
108 * {
109 * "displayName": "Total Spent Currency",
110 * "key": "ecom.totalSpentCurrency",
111 * "description": "Wix Stores currency code (read only)",
112 * "dataType": "TEXT",
113 * "namespace": "ecom",
114 * "fieldType": "SYSTEM"
115 * },
116 * {
117 * "displayName": "Last Purchase Date",
118 * "key": "ecom.lastPurchaseDate",
119 * "description": "Wix Stores last purchase date (read only)",
120 * "dataType": "DATE",
121 * "namespace": "ecom",
122 * "fieldType": "SYSTEM"
123 * },
124 * {
125 * "displayName": "Effective Subscription Status",
126 * "key": "emailSubscriptions.subscriptionStatus",
127 * "description": "SUBSCRIBED/UNSUBSCRIBED/NOT_SET/PENDING (read only)",
128 * "dataType": "TEXT",
129 * "namespace": "emailSubscriptions",
130 * "fieldType": "SYSTEM"
131 * },
132 * {
133 * "displayName": "Effective Deliverability Status",
134 * "key": "emailSubscriptions.deliverabilityStatus",
135 * "description": "VALID/BOUNCED/SPAM_COMPLAINT/INACTIVE (read only)",
136 * "dataType": "TEXT",
137 * "namespace": "emailSubscriptions",
138 * "fieldType": "SYSTEM"
139 * },
140 * {
141 * "displayName": "Effective Email",
142 * "key": "emailSubscriptions.effectiveEmail",
143 * "description": "Effective Email for subscription purposes (read only)",
144 * "dataType": "TEXT",
145 * "namespace": "emailSubscriptions",
146 * "fieldType": "SYSTEM"
147 * }
148 * ]
149 */