Query Multi-Select Picklists
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. For
example: |
Examples
The following query filters on values in the MSP1__c field that are equal to AAA and BBB selected (exact match):
1SELECT Id, MSP1__c FROM CustObj__c WHERE MSP1__c = 'AAA;BBB'In the following query:
1SELECT 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:
- AAA and BBB selected.
- CCC selected.
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':
1 'AAA;BBB'
2 'AAA;BBB;DDD'- matches with ' CCC':
1 'CCC'
2 'CCC;EEE'
3 'AAA;CCC'