i have multipicklist for industry.
I have a records which has Bank,agriculture as the selected values.
If i need to get all the records have bank and agriculture selected together. Would includes get all records which has industry of bank OR agriculture
Would it give all records with Bank and agriculture ? If it doesnt what should i use to get the and condition?
So the first thing to note is that according to the help docs
Bind expressions can’t be used with other clauses, such as INCLUDES.
This means you will probably have to use a dynamic query.
The help docs here give a great run down of the ways to query multi select picklists
For your question:
- To query the multi select picklist where Bank AND Agriculture are selected use the clause
WHERE Multi_Select__c INCLUDES ('Bank;Agriculture')
- To query Bank OR Agriculture as selected use the clause
WHERE Multi_Select__c INCLUDES ('Bank', 'Agriculture')