I have a single pick list and multi select pick list. Now, in order to query multi select pick list, you use include (:var) syntax. My situation is quite opposite - I wish to query single pick list with values from multi select pick list.
Is it possible? I suspect I need to breakdown the multi select into multiple variables and then do a dynamic SOQL query, but I though I will ask you guys first. If so, how do I break down the multi select pick list?
Or perhaps it is possible to use LIKE syntax, which doesn't make much sense.
Thanks.
Attribution to: dzh
Possible Suggestion/Solution #1
Multi-select picklists look like a semi-colon delimited string to your code. So, you can just use split(';')
to get an array of all the picklist values. You can then use the IN operator.
SELECT Name from Object__c where PicklistField__c IN :multselect.split(';')
Attribution to: Daniel Hoechst
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/30088