Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

How to use Salesforce Multipicklist field in SOQL

Be First!
by April 4, 2013 SALESFORCE, SOQL

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

(2121)

Previous
Next

Leave a Reply