Search.../

queryExtendedFields( )

Developer Preview

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 FieldsQueryBuilder 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 FieldsQueryBuilder functions onto the query. FieldsQueryBuilder functions enable you to filter, sort, and control the results that queryExtendedFields() returns.

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

  • skip()
  • limit(50)
  • descending('_createdDate')

The following FieldsQueryBuilder functions are supported for queryExtendedFields(). For a full description of the Extended Field object, see the object returned for the items property in FieldsQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
namespaceeq(),ne()
keyeq(),ne(),in()
displayNameeq(),ne(),in(),startsWith(),ascending(),descending()
dataTypeeq(),ne()
fieldTypeeq()
_createdDateeq(),ne(),gt(),lt(),ge(),le(),ascending(),descending()
_updatedDateeq(),ne(),gt(),lt(),ge(),le(),ascending(),descending()
Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function queryExtendedFields(): FieldsQueryBuilder

queryExtendedFields Parameters

This function does not take any parameters.

Returns

Return Type:

Was this helpful?

Retrieve all extended fields (dashboard page code)

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

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

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { extendedFields } from 'wix-crm.v2';
3import { elevate } from 'wix-auth';
4
5export const myQueryExtendedFieldsFunction = webMethod(Permissions.Anyone, async () => {
6 try {
7 const elevatedQueryExtendedFields = elevate(extendedFields.queryExtendedFields);
8 const queryResults = await elevatedQueryExtendedFields()
9 .eq("dataType", "NUMBER")
10 .find();
11
12 const items = queryResults.items;
13 const firstItem = items[0];
14 const pageSize = queryResults.pageSize;
15 const hasNext = queryResults.hasNext();
16 const hasPrev = queryResults.hasPrev();
17 const length = queryResults.length;
18 const query = queryResults.query;
19 console.log('Retrieved items:', items);
20
21 return items;
22 } catch (error) {
23 console.error(error);
24 // Handle the error
25
26 }
27});
28
29/* Returns items:
30 * [
31 * {
32 * "namespace": "custom",
33 * "key": "custom.age",
34 * "displayName": "Age",
35 * "dataType": "NUMBER",
36 * "fieldType": "USER_DEFINED",
37 * "legacyId": "ed349d8c-b2bc-46a4-80d8-7632c6f50b00",
38 * "wixSearchColumn": "info_extendedFields_custom_double_27",
39 * "_createdDate": "2023-12-25T12:16:40.000Z",
40 * "_updatedDate": "2023-12-25T12:16:40.000Z"
41 * },
42 * {
43 * "namespace": "ecom",
44 * "key": "ecom.numOfPurchases",
45 * "displayName": "# of Purchases",
46 * "dataType": "NUMBER",
47 * "fieldType": "SYSTEM",
48 * "description": "Wix Stores purchase count (read only)"
49 * },
50 * {
51 * "namespace": "ecom",
52 * "key": "ecom.totalSpentAmount",
53 * "displayName": "Total Spent Amount",
54 * "dataType": "NUMBER",
55 * "fieldType": "SYSTEM",
56 * "description": "Wix Stores aggregated spent amount (read only)"
57 * }
58 * ]
59*/
60