+ Start a Discussion
SforcehariSforcehari 

MultiPicklist selected Values on records and Querying with single Value

Hai To Salesforce,

 

 I have Multi select picklist selected values on records like,

 

 on Record one,we have like     

 1. Apple;Banana;Orange

 

 on Second ,we have like     

2. Apple;Banana

 

on Third Record ,we have like     

3. Apple;orange.

 

on fourth Record we have like

4. Apple.

 

 

Now i have designed a page, there i have picklist of Values like Apple,Orange,banana,, when i select a value from picklist like Apple i need to show all 4 records,because Apple is in All four records.But i am getting only single record.

 

To get and show all on Vfpage, we can't Use LIKE operator in Query from Multiselect picklist Values.

 

is there any way!

 

Regards,

Haribabu Amudalapalli

 

Rahul SharmaRahul Sharma

Hello hari, 

 

I think this would work:

1) Take all the records in a map<String, your object Name Object>

2) In its key store the multiselect picklist value.

3) Then after selecting the picklist in page, take all the records in a list to display records which contains that selected picklist value. (Use string.contains(Selected Picklist value) to filter/get all the records.)