You can search for individual values in multi-select picklists, which are regularly used in client applications.
Client applications use a specific syntax for querying multi-select picklists, which allows selection of multiple items . In API version 39.0 and later, query for picklist values by the value’s API name, which can be different from the actual value.
The following operators are supported for querying multi-select picklists:
| Operator | Description |
|---|---|
= |
Equals the specified string. |
!= |
Does not equal the specified string. |
includes |
Contains the specified string. |
excludes |
Does not contain the specified string. |
; |
Specifies AND for two or more strings. Use ; for multi-select picklists when two or more items must be selected. |
Example ; operator:
'AAA;BBB'
Examples
The following query filters on values in the MSP1__c field that are equal to AAA and BBB selected (exact match):
SELECT Id, MSP1__c FROM CustObj__c WHERE MSP1__c = 'AAA;BBB'
In the following query:
SELECT Id, MSP1__c from CustObj__c WHERE MSP1__c includes ('AAA;BBB','CCC')
the query filters on values in the MSP1__c field that contains either of these values:
AAAandBBBselected.CCCselected.
A match will result on any field value that contains 'AAA' and 'BBB' or any field that contains 'CCC'. For example, the following will be matched:
- matches with '
AAA;BBB':
'AAA;BBB'
'AAA;BBB;DDD'
- matches with '
CCC':
'CCC'
'CCC;EEE'
'AAA;CCC'