You need to sign in to do that
Don't have an account?
Querying multi picklist
hey i have a multipicklist in my code that consists of the following values:
MultiSelectField values: "100" , "200", "300", "400" and so forth.
So I created a Custom Label and the value consist of "100".
Api Name: Custom_Label
Value: 100
In my code I have the following
List <string> strList = new List <string> ();
add.strList(label.CustomLabel);
in my query i have the following:
List <object> obj = [select id, multiselect from object where multiselect IN: (strList)];
is this the best practice to retrieve record based on multipicklist value? I am trying to limit any hardcoding of values because it may change in the future?
Also maybe in the future i want to add an extra value into my list based on the multi-select, for example I want only records with multipicklist containing "100" or "200"?
Any thoughts?
Hi Eric,
In order to retrive records based on values entered for a multi-picklist, you need not use hardcoded custom labels. For example
You can also refer to the following document : http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_querying_multiselect_picklists.htm
Hope this helps.
Hi ericmonte,
Use following Soql query to use multiselect picklist.
I think this will work for 100,200,300,400 picklist value.