New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.LimitException: reports:Too many query rows: 50001 #17

Open
Jalps1018 opened this Issue Sep 18, 2017 · 8 comments

Comments

4 participants
@Jalps1018
Copy link

Jalps1018 commented Sep 18, 2017

Hi Doug,

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
(dca_cmpgn_apps)**

Thanks
Jalpa

@douglascayers douglascayers self-assigned this Sep 18, 2017

@douglascayers

This comment has been minimized.

Copy link
Owner

douglascayers commented Sep 18, 2017

Hi @Jalps1018,

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,

Doug

@Jalps1018

This comment has been minimized.

Copy link

Jalps1018 commented Sep 18, 2017

Hi @douglascayers

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?

thanks
Jalpa

@douglascayers

This comment has been minimized.

Copy link
Owner

douglascayers commented Sep 27, 2017

Hi @Jalps1018,

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.

@Jalps1018

This comment has been minimized.

Copy link

Jalps1018 commented Sep 28, 2017

Hi @douglascayers thanks for the update. It doesn't seem like currently there is any solution for this!

@mvenman

This comment has been minimized.

Copy link

mvenman commented Mar 30, 2018

@douglascayers I may be seeing this issue with ~11k records in my report - could that be possible?

@douglascayers

This comment has been minimized.

Copy link
Owner

douglascayers commented Mar 30, 2018

Yes @mvenman, sorry. Until the Reports API is changed on the Salesforce backend, then this solution is limited to reports with probably no more than 10,000 rows =(

@mvenman

This comment has been minimized.

Copy link

mvenman commented Mar 30, 2018

AHA. Thanks @douglascayers! I'm going to give the ListView a Shot and see if that fixes things. Thanks for getting back to me!

@danhowellnz

This comment has been minimized.

Copy link

danhowellnz commented Mar 30, 2018

@mvenman
Try the ListView if problems you can implement a simple workaround/hack of splitting it into two reports. Filter on the characters in an id or name to arbitrarily create smaller reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment