Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Create Advanced Visualforce Dashboard Components
Create a Visualforce page with a custom list controller, then use it as a dashboard
component.
| Available in: Salesforce Classic (not available in all orgs) |
| Available in: all editions |
This Visualforce dashboard component displays all of the open
cases associated with a contact named “Barbara
Levy.”
-
Create a custom list controller called retrieveCase.
1public class retrieveCase { 2 3 public String getContactName() { 4 return 'Barbara Levy'; 5 } 6 7 public List<Case> getCases() { 8 return [SELECT status, subject FROM Case 9 WHERE Contact.name = 'Barbara Levy' AND status != 'Closed' limit 5]; 10 } 11} -
Create a Visualforce page that uses the retrieveCase custom controller.
1<apex:page controller="retrieveCase" tabStyle="Case"> 2 <apex:pageBlock> 3 {!contactName}'s Cases 4 <apex:pageBlockTable value="{!cases}" var="c"> 5 <apex:column value="{!c.status}"/> 6 <apex:column value="{!c.subject}"/> 7 </apex:pageBlockTable> 8 </apex:pageBlock> 9</apex:page> - To add the Visualforce page to a dashboard, see Add a Dashboard Component in Salesforce Classic.
