Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
System.LimitException: reports:Too many query rows: 50001 #17
I have installed the managed package to 'Add campaign members by report' and it has been fantastic for past month. I have set up several reports for different campaigns and it has been working fine. However, now I am receiving an error as below. Can you please advise what can I do to resolve this limit error?
**Apex script unhandled exception by user/organization: 00520000004a1gh/00D20000000mpp0
Failed to process batch for class 'dca_cmpgn_apps.AddCampaignMembersByReportBatchable' for job id '7070O00004DD1cV'
caused by: System.LimitException: reports:Too many query rows: 50001
External entry point
Can you confirm if your Campaign already has 50,000 campaign members or is it the report that has that many rows in it?
If it's only the report, as workaround perhaps try using multiple reports that filter to less than 50,000 rows each and map each report to the same campaign.
50,000 rows in SOQL query is a Salesforce governor limit that I may not be able to work around since the report data is already being batched.
Thanks for the response.
Looking at the campaign and the report, neither of them has more than 50,000 records. However, I have set up 5 different report subscriptions which probably runs at the same time. Could that cause the Salesforce governor limit? If I change the time each report runs, will that make a difference?
Unfortunately, I think this may be major limitation of the Reports API in Apex.
Iñigo PuigPey reported similar issue on the developer forums, https://developer.salesforce.com/forums/?id=9060G000000IBaOQAW
And I found on Salesforce Foundation (who developed the underlying Report querying code my project uses) also says this is a limitation, SalesforceFoundation/CampaignTools#88. According to one commenter, they say the limit may even be seen with reports with as few as 14,000 records =(
The limitation is not based on how many reports you have scheduled in the tool as each runs as their own background job with their own governor limits. This is an unfortunate quirk of the reporting API.