Returns the items that match the query.
The current page of items retrieved by the query.
List of labels.
Note: When no items match the query, the items array is empty.
To paginate your query results, use the LabelsQueryResult
pagination properties and functions.
import { Permissions, webMethod } from "wix-web-module";
import { contacts } from "wix-crm-backend";
export const getQueryResultItems = webMethod(Permissions.Anyone, () => {
return contacts
.queryLabels()
.limit(5)
.find()
.then((results) => {
if (results.items.length > 0) {
return results.items;
} else {
console.log("No items found");
}
})
.catch((error) => {
console.error(error);
});
});
/* items:
* [
* {
* "_createdDate": "2021-01-20T06:55:58.000Z",
* "displayName": "White Glove Treatment",
* "key": "custom.white-glove-treatment",
* "labelType": "USER_DEFINED",
* "namespace": "custom",
* "_updatedDate": "2021-01-20T06:55:58.000Z"
* },
* {
* "_createdDate": "2021-01-20T06:55:47.000Z",
* "displayName": "At Risk",
* "key": "custom.at-risk",
* "labelType": "USER_DEFINED",
* "namespace": "custom",
* "_updatedDate": "2021-01-20T06:55:47.000Z"
* },
* {
* "_createdDate": "2021-01-20T00:31:41.000Z",
* "displayName": "Active Customer",
* "key": "custom.active-customer",
* "labelType": "USER_DEFINED",
* "namespace": "custom",
* "_updatedDate": "2021-01-20T00:31:41.000Z"
* },
* {
* "displayName": "Customers",
* "key": "contacts.customers",
* "labelType": "SYSTEM",
* "namespace": "contacts",
* },
* {
* "displayName": "Contacted Me",
* "key": "contacts.contacted-me",
* "labelType": "SYSTEM",
* "namespace": "contacts",
* }
* ]
*/