Create a Visualforce page with a custom list controller, then use it as a dashboard component.
| Required Editions |
|---|
| Available in: Salesforce Classic (not available in all orgs) |
| Available in: all editions |
note: Visualforce pages as dashboard components are only available in Salesforce Classic. In Lightning Experience, you can create a custom tab and use that as a dashboard for your custom lightning components.
To be included in a dashboard, a Visualforce page must use a custom controller, use a standard or custom list controller, or not have a controller. You can’t add a Visualforce page with a standard controller to a dashboard. Only Visualforce pages that meet these requirements appear as options in the Data Sources tab.
Visualforce dashboard components aren’t supported when third-party cookies are disabled. See Visualforce Limitations in Salesforce Classic When Third-Party Cookies are Blocked.
This Visualforce dashboard component displays all of the open cases associated with a contact named “Barbara Levy.”
-
Create a custom list controller called
<!-- otherprops: apex_code set_clipboard -->retrieveCase.public class retrieveCase { public String getContactName() { return 'Barbara Levy'; } public List<Case> getCases() { return [SELECT status, subject FROM Case WHERE Contact.name = 'Barbara Levy' AND status != 'Closed' limit 5]; } } -
Create a Visualforce page that uses the
<!-- otherprops: apex_page set_clipboard -->retrieveCasecustom controller.<apex:page controller="retrieveCase" tabStyle="Case"> <apex:pageBlock> {!contactName}'s Cases <apex:pageBlockTable value="{!cases}" var="c"> <apex:column value="{!c.status}"/> <apex:column value="{!c.subject}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page> -
To add the Visualforce page to a dashboard, see Add a Dashboard Component in Salesforce Classic.

See Also