You need to sign in to do that
Don't have an account?
Reports Too many query rows: 50001
Hello,
I have an issue executing a report from Apex. I am getting the Fatal Error "Too many query rows: 50001" when I execute the method "Reports.ReportManager.runReport(reportId, reportMetadata, includeDetails)".
The report returns 13.000 contacts, but when I execute it from apex, it only return the first 2,000 contacts. To get all the records y execute the same report adding a new filter to exclude the contacts I already got adding "Reports.ReportFilter('Contact.Id', 'greaterThan', lastContactId);"
So if the report must return 13,000 records, I will have to run the report 8 times. Every time I run the report I consult the limits and I always get 3 in "Limits.getQueryRows()", but when is executing the report for 5th time I get this exception "System.LimitException: reports:Too many query rows: 50001"
My conclusion is that as the report has 13,000 records, it adds to the limit 13,000 records to the limit everytime the report is executed, so if the report has 50,000 record I will not be able to execute the report not eve once. But if I check the limit with "Limits.getQueryRows()" I will always get 3 records, and never 50,001.
Can anyone help me with this issue? Has anyone launched a report with more than 50,000 records from apex?
Thank you
I have an issue executing a report from Apex. I am getting the Fatal Error "Too many query rows: 50001" when I execute the method "Reports.ReportManager.runReport(reportId, reportMetadata, includeDetails)".
The report returns 13.000 contacts, but when I execute it from apex, it only return the first 2,000 contacts. To get all the records y execute the same report adding a new filter to exclude the contacts I already got adding "Reports.ReportFilter('Contact.Id', 'greaterThan', lastContactId);"
So if the report must return 13,000 records, I will have to run the report 8 times. Every time I run the report I consult the limits and I always get 3 in "Limits.getQueryRows()", but when is executing the report for 5th time I get this exception "System.LimitException: reports:Too many query rows: 50001"
My conclusion is that as the report has 13,000 records, it adds to the limit 13,000 records to the limit everytime the report is executed, so if the report has 50,000 record I will not be able to execute the report not eve once. But if I check the limit with "Limits.getQueryRows()" I will always get 3 records, and never 50,001.
Can anyone help me with this issue? Has anyone launched a report with more than 50,000 records from apex?
Thank you
Please check with below post from stack exchange community with the same issue while using batch apex.This might be helpful for you to accelerate with the above requirement.
http://salesforce.stackexchange.com/questions/15456/too-many-query-rows-50001
Kindly mark this post as solved if the information help's so that it gets removed from the unanswered queue and becomes a proper solution which results in helping others who are really in need of it.
I hope it will be helpful.
Best Regards
Rahul Kumar
I have got the exact same problem. Did you find a solution?
I'm sorry Rahul Kumar, but your answer is not a solution for the Apex/Report problem.
The following error messages are two different problems:
- Too many query rows: 50001
- reports.Too many query rows: 50001
The second one is our problem. Thanks in advance!The ugly part of my solution is that a Queueable class ends up requeueing itself as a way of polling for the asynchronrous report run to finish. Which is not very nice, but it does seem to work. I've had this work on a report with 27k rows.
Something like this:
I got the same issue too. Did you find the solution?
Please let me know.
Thanks,
Sirisha