You need to sign in to do that
Don't have an account?

How to query the count of lead status
HI All,
I have an object that is lead one in that I need to count the lead picklist values. let say we have 100 records in the lead , 10 records status are lead = open, another 10 are closed like this I need to display using soql.
Thanks & Regards
Raveendra
I have an object that is lead one in that I need to count the lead picklist values. let say we have 100 records in the lead , 10 records status are lead = open, another 10 are closed like this I need to display using soql.
Thanks & Regards
Raveendra
Hi Ravindra,
In the soql you just query select id , name from lead where Status = 'Open'
And in the vf page, make a pageBlock table and you can show those records. i am not sure if this is what you are asking.
Please let me know if this helps.
Thanks,
Manohar
I need to count the status field values
Thanks
Raveendra
select id , name, count(status) from lead where Status != null
please try this,
select status, count(Id) from lead group by status
you may also refer
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_count.htm
please mark it as solved if it helps solving ur problem
if you want to use Soql Query to find Status of Lead so Status picklist have four Default values they are....
Open - Not Contacted
Working - Contacted
Closed - Converted
Closed - Not Converted
so your Query would depend picklist value
select id, name,status from lead where status='Open - Not Contacted' OR status='Closed - Not Converted'
if this would helpful marked as best answer
Thank you
Avaneesh Singh
There is no partiular soql query for that, try to select id , name from lead where Status = 'Open' in the following way, it will give you the total Query Results on you can count in that way,check below screenshot fy!
select count(status) from lead where status='Open - Not Contacted' OR status='Closed - Not Converted'
check this Query result
Thank you
Avaneesh singh
you can use below query to get the total no of recorrds using below query.Also system.Limit exception will be thrown
if you have more than 5000 records So use below code to get the total count.
Source:
https://salesforce.stackexchange.com/questions/102193/need-to-count-more-than-50000-records-but-not-able-to-do-it-even-with-readonly-a
Thanks
D Naveen Rahul.