2

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.