Multiselect Picklists for User Search and Selection using Apex and Visualforce

9 Dec

Below is a component that will allow you to search and select Users. It was created to mimic the experience of selecting multiple users in the Task creation window. However, it would be easy to change the reference from the User object to almost any other object.

An initial list of selected users can be assigned by passing an Id list in the component attribute aInitialRightList. The list referenced in the aCurrentRightList attribute will be updated anytime entries in the right multiselect picklist change. The aWidth attribute accepts px or %, and it sets the width of the entire component.

I’d like to thank those who posted sample code that helped me with the multiselect picklist component. I borrowed ideas and code from the following:
Custom Multi-Select picklist field in Visualforce
A Multiselect Picklist Visualforce Component

Multi Select Picklist Visualforce Component Example

UserMultiSelectComponent.component

UserMultiSelectComponentController.cls

ExamplePage.page

ExamplePageController.cls

UserMultiSelectComponentControllerTest.cls

One Reply to “Multiselect Picklists for User Search and Selection using Apex and Visualforce”

  1. Awesome, thanks! We are creating a “stakeholders” relationship, connecting user(s) to product(s). This is a great UI for picking up the users.

    The sample code worked perfectly.

Comments are closed.