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
krish99krish99 

leads in visualforce page

HI,

           How can i get today creation leads into visulfroce page

 Example--->>  Today leads:4  in this format.

nbknbk

Please find the below vfp sample code to get the leads count. Create following vfp and class in your org and execute the page you will get count of leads. Please let me know if you have any questions

VFP:

<apex:page controller="LeadsCount">
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  <apex:form >
      Leads created today {!cntcount}
  </apex:form>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
</apex:page>

 

Class:

 

public class LeadsCount
{
    public integer cntcount{get;set;}
    
    public LeadsCount()
    {
        list<lead> a=[select id from lead where createddate=today ];
        if(a.size()>0)
        {
            cntcount = a.size();
        }
        else
        {
            cntcount=0;
        }
    }
}

krish99krish99

@nbk

 

   Thanks for reply suppose if i want today accounts,contacts, opprtunity 

 

   what i have to do..??

nbknbk

Hi Krish,

 

You need to query each object and store into respective variable and use in VFP accordingly. Let me know if you have any feasible approach other than this to get the details into vfp.

 

 

Thanks,

Balakrishna

ShahTheTrainerShahTheTrainer

Have you tried <apex:enhancedList> if you want to display various ListViews in single VFP, when you want to display the records.

 

If you just want to display "RecordsCount", obviously 3 integer variables, 3 SOQLs.