Enhanced list views on a Visualforce page

Enhanced lists are used when you want to display a specific list view for a standard or custom object, rather than having all list views available for the user to select.

Step 1 – Create the list view
Go to the standard or custom object and click on the Create New View next to the Go button. Create the view and click on Save. When the page has reloaded, you will notice in the url a 15 digit id has been created for your view. Copy or make a note of the id.

Step 2 – Add code to your visualforce page
Add the following bit of code to your visualforce page, replacing the listid with your id:

<apex:enhancedlist type=”Lead” height=”730″ customizable=”false” rowsPerPage=”25″ Listid=”00B30000007wesH” />

Change customizable to equal true if you want your users to be able to edit the filters on the view. Once saved, you should find your visualforce page displays an enhanced list similar in appearance to the image below.

About these ads

10 thoughts on “Enhanced list views on a Visualforce page

  1. Ive been searching all over for this and can see from your screenshot is that your page has the same issue.

    I have built my page as above and the drop down list that allows the user to switch views has now disapeared. How can this be reinstated?

    Hope someone knows this :).


    • Hi Arun,

      The only thing I can think of is when you create the list views, restrict the visibility of the view to just the users that you want to see the list. Then if you remove the listid from the code above, users will just see the list views that you have allowed for their role or any groups they are in.

    • Hi Vaishali,

      The only way I know to remove the button is to remove from the object search layout, so it would disappear from any other contact pages you may have created and the default contact page. To do so:

      For standard objects go to:
      Setup | Customize | | Search Layouts

      Then click Edit next to List View

      For custom objects:
      Setup | Create | Objects |

      Then click Edit next to List View

    • Hi Gary,

      I haven’t found a way of removing or changing the style of the header. I’m not a massive fan of it when you specify a particular list as the header comes out very large.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s