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

How to create lead list view count in homepage using vfpage

We have requirement to develop vf page on salesforce home page to all lead list view. If user clicks it will redirect to particular lead list view. Also, the count of each list view to display after the list name.

Appreciate any help.
ayu sharma devayu sharma dev
Hello SFDC_bi

Please try to use the below code:

Visualforce page
<apex:page Controller="TestController">
    <apex:form >
        <apex:repeat value="{!leadListViews}" var="lsitVName">
            <apex:outputlink value="{!leadListViews[lsitVName]}">{!lsitVName}</apex:outputlink>

Apex Controller
public class TestController {
    public Map<String, String> leadListViews{get;set;}
    public TestController(){
        leadListViews = new Map<String, String>();
        for( ListView listV : [ SELECT Id, DeveloperName, Name FROM ListView 
                                         WHERE IsSoqlCompatible = True AND SobjectType = 'Lead' ] )
            leadListViews.put( listV.Name, '/00Q?fcf='+String.valueOf(listV.Id).substring( 0,15 ) );

But I am not able to get the Count of right now. I am looking for a way to get the count also. 
Hope this helps

Thanks and Regards 
Ayus Sharma
Thanks ayu sharma dev. Count number is very important. Please help me.