i need to select multiple values in lookup input field of Vf page, how is it possible. Please let me know guys if you have any work around also.

  • Actually i need to pass this vf page in Quick action, but i am not getting the way to achieve this, i searched in google also, didn't get right stuff on this requirement, if you know any way to achieve this please let me know Dan.. – prasad nagamalli May 16 '17 at 7:53
  • If you want something that looks like what is presented in layout-based UI, use github.com/metadaddy/Visualforce-Multiselect-Picklist. – Keith C May 16 '17 at 10:01

I recently used 'apex:selectCheckboxes' with the respective lookup candidates as 'apex:selectOptions'.

On page load or rerender the 'apex:selectCheckboxes' element the records are queried, filtered by the conditions you need and displayed to the user with checkboxes.

<apex:pageBlockSection id="recordSelection">
        <apex:selectCheckboxes layout="pageDirection" value="{!listOfPickedRecords}" rendered="{!true,true,false)}">
            <apex:selectOptions value="{!queryRecordsMethod}"/>
  • Thanks Schnaps, it would be great if you please share some code on this. – prasad nagamalli May 16 '17 at 7:56
  • With so little information around your question it's hard to post the right specific code. Example code for selectCheckboxes and selecOptions is available in the docu and on the web. As the selectOptions' value property you pass your controller's method, that handles the SOQL query to get the records of the lookup object and returns them. The value property of the selectCheckboxes element is linked to a 'list<YourObject>' variable of your controller. In that variable you process all the records, that the user checked. – Schnaps May 16 '17 at 9:05

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.