3

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.

1 Answer 1

4

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(';')

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .