Search...
hasSome( )
Refines a query to match items whose specified property value contains any of the specified values.
Description
The hasSome()
function refines a ContactsQueryBuilder
to only
match items where any of the values of the array of the specified property equal any of
the specified values.
Matching with hasSome()
is case-sensitive in most instances, so "text"
is not equal to "Text"
.
One exception is email fields, which are case insensitive when matching with hasSome()
.
Syntax
function hasSome(propertyName: string, values: Array<string>): ContactsQueryBuilder
hasSome Parameters
NAME
TYPE
DESCRIPTION
propertyName
string
The property whose value will be compared with value
.
Supported properties:
"_id"
"primaryInfo.email"
"primaryInfo.phone"
"info.name.first"
"info.name.last"
"info.emails.email"
"info.phones.phone"
"info.addresses.street"
"info.addresses.city"
"info.addresses.subdivision"
"info.addresses.country"
"info.company"
"info.jobTitle"
"info.locale"
"info.labelKeys"
values
Array<string>
The values to match against.
Returns
A ContactsQueryBuilder
object that contains the refined query.
Return Type:
Was this helpful?
Add a
hasSome
filter to a queryCopy Code
1const query = contacts.queryContacts()2.hasSome("info.extendedFields.members.membershipStatus", ["APPROVED", "DENIED", "PENDING", "INACTIVE"]);
Create a query, add a
hasSome
filter, and run itCopy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { contacts } from 'wix-crm-backend';34export const myQueryContactsFunction = webMethod(Permissions.Anyone, () => {5 return contacts.queryContacts()6 .hasSome("info.labelKeys", ["custom.white-glove-treatment", "custom.at-risk"])7 .find()8 .then((results) => {9 if (results.items.length > 0) {10 const items = results.items;11 const firstItem = items[0];12 const pageSize = results.pageSize;13 const hasNext = results.hasNext();14 const hasPrev = results.hasPrev();15 const length = results.length;16 const query = results.query;1718 return items;19 } else {20 // Handle case where no matching items found21 }22 })23 .catch((error) => {24 console.error(error);25 })2627});