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