Custom List View to display VF Page

  • Is it possible to display a VF page for a custom list view ?

    enter image description here

    From the above, instead of those list columns I want to render a VF page containing a list of cases.

  • You have a few options, you could use an apex:enhancedList on your Visualforce page, which is covered in the documentation here.

    <apex:page>
        <apex:enhancedList type="Case" height="300" rowsPerPage="10" id="YourListViewId" />
    </apex:page>
    

    Alternatively you can use a Standard List Controller (with an apex:repeat, apex:dataTable or apex:pageBlockTable and set the fcf parameter in your URL to the desired List View ID.

    <apex:page standardController="Case" recordSetVar="cases">
        <apex:repeat value="{!cases}" var="c">
            <apex:outputText value="{!c.Id}"/>
        </apex:repeat>
    </apex:page>
    

    Then navigate to the page using a URL similar to this: http://yourinstance.salesforce.com/apex/YourListPage?fcf=YourListViewId


    Finally, you can use a StandardSetController within a Custom Controller and set the desired ListView in Apex using setFilterID, which is covered in the documentation here.

    <apex:page controller="CaseList">
        <apex:repeat value="{!cases}" var="c">
            <apex:outputText value="{!c.Id}"/>
        </apex:repeat>
    </apex:page>
    

    Then your Controller will look something like this:

    public class CaseList
    {
        private ApexPages.StandardSetController ssc;
    
        public CaseList
        {
            List<Case> caseList = [SELECT Name FROM Case];
    
            ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(caseList);
            ssc.setFilterID(YourFilterId);
        }
    
        public List<Case> getCases() 
        {
            return (List<Case>)ssc.getRecords();
        }
    }
    

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM