How to use Salesforce Multipicklist field in SOQL?
Consider here BillingState is a Multipicklist and we need to list out only certain states like California and New York.
We can achieve using either INCLUDES or EXCLUDES Operators (its working only multi-select picklists).
Example 1:
list<Account> lstACC = [SELECT Id, Name, BillingState, Country FROM Account where BillingState INCLUDES (‘California’, ‘New York’)];
system.debug(‘LIST OF ACCOUNT’ + lstACC);
Example 2:
String states = ‘California;New York’;
List<Account> lstACC = [select Id, Name, BillingState, Country FROM Account where BillingState INCLUDES (:states) LIMIT 100];
system.debug(‘LIST OF ACCOUNT’ + lstACC);
To Know more about, CLICK HERE