function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shivani KalsiShivani Kalsi 

i want to add visualforce page on list view page , how to add it?

NagendraNagendra (Salesforce Developers) 
Hi Shivani,

Below is the visual force page which renders 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(https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_enhancedList.htm).
<apex:page>
    <apex:enhancedList type="Case" height="300" rowsPerPage="10" id="YourListViewId" />
</apex:page>
Alternatively, you can use a Standard List Controller(https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_about.htm) (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(https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_ApexPages_StandardSetController_setFilterID.htm).
<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();
    }
}
Hope this helps.

Kindly mark this as solved if the information was helpful.

Thanks,
Nagendra
Pankaj Yadav 16Pankaj Yadav 16
How can i get the data of case as per login user- sorting process not working 


Apex page
public class NewCaseList {
        List<Case> results = [Select CaseNumber, Subject, Priority, Origin FROM Case WHERE OwnerId= :UserInfo.getUserID()];
             
        public List<Case> getresults()
        {       
            return results;
        }
   
    List<Case> results1 = [SELECT CaseNumber,Origin,Priority,Subject FROM Case WHERE Priority = 'High' ];
             
        public List<Case> getresults1()
        {       
            return results1;
        }
public NewCaseList()
    {
        List<Case> caseList = [Select CaseNumber, Subject, Priority, Origin FROM Case WHERE OwnerId= :UserInfo.getUserID()];
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(caseList);
       ssc.setFilterId(filterId);
    }
    public List<Case> getCases()
    {
        return (List<Case>)ssc.getRecords();
    }
   
}





Visual force page
<apex:page standardController="Case"  recordSetvar="case">
 
    <apex:pageBlock title="Viewing Cases">
  <apex:form id="theForm">
    <apex:panelGrid columns="2">
      <apex:selectList value="{!filterId}" size="1">
        <apex:actionSupport event="onchange" rerender="list"/>
        <apex:selectOptions value="{!listviewoptions}"/>
      </apex:selectList>
    </apex:panelGrid>
      <apex:pageBlock>
      <apex:pageBlockTable var="a" value="{!Case}" id="list" >
      <apex:column>
            <apex:outputLink value="{! URLFOR($Action.Case.Edit, a.Id) }">
                Edit
            </apex:outputLink>
            &nbsp;
            <apex:outputLink value="{! URLFOR($Action.Case.Delete, a.Id) }">
                Del
            </apex:outputLink>
          </apex:column>
          <apex:column value="{!a.CaseNumber}"/>
             <apex:column value="{!a.Priority}"/>
             <apex:column value="{!a.Subject}"/>
             <apex:column value="{!a.Origin}"/>  
         </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:form>
  </apex:pageBlock>
</apex:page>
Pankaj Yadav 16Pankaj Yadav 16
it is simmilar issue that is the reason i posted.