You would like to create a custom tab to display a specific list view for a standard or custom object rather than use the standard tab view that only displays recently viewed records.
- From the standard or custom object tab, Edit an existing view or ‘Create New View.’
- Ensure that you give the view a Name, that you specify filter criteria, that you select the fields to display, and that you restrict visibility as necessary.
- When the view has been saved and you are returned to the tab, select the view from the dropdown.
- Copy the 15-character view ID in the URL and paste it to Notepad, or write it down.
- Create a new VisualForce page (Setup / App Setup / Develop / Pages) using the sample code provided below.
- Create a new VisualForce tab (Setup / App Setup / Create / Tabs) and select the VisualForce Page created in Step #5, provide a Tab Label, Tab Name, and Tab Style, and then apply the desired profile visibility for the new tab.
- Optional – hide the tab for the standard or custom object if your new tab is a replacement for the default tab.
- If you want to change the View that is displayed in the tab at any time, simply navigate back to the standard tab for the object and Edit the view to meet requirements.
The VisualForce Page code:
Note: Replace “xxxxxxxxxxxxxxx” with the 15-character ID of the View that you captured in Step #4 above. You can adjust the ‘height’, ‘customizable’, and ‘rowsPerPage’ values as desired.
<apex:page> <apex:enhancedList listId="xxxxxxxxxxxxxxx" height="600" customizable="false" rowsPerPage="25"/> </apex:page>