Creates a query to retrieve a list of extended fields.
The queryExtendedFields()
method 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()
method.
You can refine the query by chaining FieldsQueryBuilder
methods onto the query. FieldsQueryBuilder
methods 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
methods are supported for queryExtendedFields()
. For a full description of the Extended Field
object, see the object returned for the items
property in FieldsQueryResult
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
namespace | eq() ,ne() |
key | eq() ,ne() ,in() |
displayName | eq() ,ne() ,in() ,startsWith() ,ascending() ,descending() |
dataType | eq() ,ne() |
fieldType | eq() |
_createdDate | eq() ,ne() ,gt() ,lt() ,ge() ,le() ,ascending() ,descending() |
_updatedDate | eq() ,ne() ,gt() ,lt() ,ge() ,le() ,ascending() ,descending() |
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function queryExtendedFields(): FieldsQueryBuilder;
import { extendedFields } from "wix-crm.v2";
export async function myQueryExtendedFieldsFunction() {
try {
const queryResults = await extendedFields.queryExtendedFields().find();
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;
console.log("Retrieved items:", items);
return items;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Returns items:
* [
* {
* "namespace": "custom",
* "key": "custom.nickname",
* "displayName": "Nickname",
* "dataType": "TEXT",
* "fieldType": "USER_DEFINED",
* "legacyId": "63408eaf-e3d0-43f3-afa5-942847d272a1",
* "wixSearchColumn": "info_extendedFields_custom_string_18",
* "_createdDate": "2023-12-25T12:21:42.000Z",
* "_updatedDate": "2023-12-25T12:22:25.000Z"
* },
* {
* "namespace": "custom",
* "key": "custom.age",
* "displayName": "Age",
* "dataType": "NUMBER",
* "fieldType": "USER_DEFINED",
* "legacyId": "ed349d8c-b2bc-46a4-80d8-7632c6f50b00",
* "wixSearchColumn": "info_extendedFields_custom_double_27",
* "_createdDate": "2023-12-25T12:16:40.000Z",
* "_updatedDate": "2023-12-25T12:16:40.000Z"
* },
* {
* "namespace": "contacts",
* "key": "contacts.displayByFirstName",
* "displayName": "Display Name (start with first)",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "Display name starting with first name (read only)"
* },
* {
* "namespace": "contacts",
* "key": "contacts.displayByLastName",
* "displayName": "Display Name (start with last)",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "Display name starting with last name (read only)"
* },
* {
* "namespace": "invoices",
* "key": "invoices.vatId",
* "displayName": "VAT ID",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "Vat ID for Wix Invoices"
* },
* {
* "namespace": "members",
* "key": "members.membershipStatus",
* "displayName": "Membership Status",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "APPROVED/DENIED/PENDING/INACTIVE/OFFLINE_ONLY (read only)"
* },
* {
* "namespace": "members",
* "key": "members.mobile",
* "displayName": "Mobile flag",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "true/false"
* },
* {
* "namespace": "ecom",
* "key": "ecom.numOfPurchases",
* "displayName": "# of Purchases",
* "dataType": "NUMBER",
* "fieldType": "SYSTEM",
* "description": "Wix Stores purchase count (read only)"
* },
* {
* "namespace": "emailSubscriptions",
* "key": "emailSubscriptions.subscriptionStatus",
* "displayName": "Effective Subscription Status",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "SUBSCRIBED/UNSUBSCRIBED/NOT_SET/PENDING (read only)"
* },
* {
* "namespace": "emailSubscriptions",
* "key": "emailSubscriptions.deliverabilityStatus",
* "displayName": "Effective Deliverability Status",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "VALID/BOUNCED/SPAM_COMPLAINT/INACTIVE (read only)"
* },
* {
* "namespace": "emailSubscriptions",
* "key": "emailSubscriptions.effectiveEmail",
* "displayName": "Effective Email",
* "dataType": "TEXT",
* "fieldType": "SYSTEM",
* "description": "Effective Email for subscription purposes (read only)"
* }
* ]
*/
There are 6 errors with this status code.
This method may also return standard errors. Learn more about standard Wix errors.