You need to sign in to do that
Don't have an account?
CustomDataIntegrations
Get Record counts in tables
How do I get the total record count from a table (i.e. Account, Lead, Contact)? I have over 50,000 records in the Lead table. When I run the query below in my code, it fails with the "Too many query rows: 50001" error.
LeadRecordCount = [select Count() from lead];
LeadRecordCount = [select Count() from lead];
Also, depending on your implmenetation, you might be able to use the @readonly annotation for your class, this can get around some of the limits but it has various limitations of its own, info here: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_classes_annotation_ReadOnly.htm|StartTopic=Content%2Fapex_classes_annotation_ReadOnly.htm|SkinName=webhelp