SalesforceFoundation / NPSP

The current version of the Salesforce.org Nonprofit Success Pack
http://www.salesforce.org/nonprofit/nonprofit-success-pack/
BSD 3-Clause "New" or "Revised" License
16 stars 3 forks source link

NPSP setting - npsp:Too many query rows: 50001 #7181

Open KaTzi-42 opened 1 year ago

KaTzi-42 commented 1 year ago

When I click on the "NPSP Setting" tab, I receive the following error:

npsp:Too many query rows: 50001
Error is in expression '{!onNpspSettingsLoad}' in component [apex:page](javascript:void(0)) in page npsp:stg_settingsmanager: (System Code)

An unexpected error has occurred. Your solution provider has been notified. (Database)

In the logs, it is evident that the page is hitting a limit while loading.

17:08:41.416 (928882000)|SOQL_EXECUTE_BEGIN|[157]|Aggregations:0|SELECT Id, CronExpression, CronJobDetail.Name, CreatedBy.Name, CreatedBy.IsActive FROM CronTrigger WHERE CronJobDetail.JobType = '7'
17:08:41.416 (1339652764)|SOQL_EXECUTE_END|[157]|Rows:49869

Why is NPSP executing such a strange SOQL query without a filter? SELECT Id, CronExpression, CronJobDetail.Name, CreatedBy.Name, CreatedBy.IsActive FROM CronTrigger WHERE CronJobDetail.JobType = '7' image

rodolforicojr commented 1 year ago

We also encountered the same issues.

19:27:21.791 (792245605)|VARIABLE_SCOPE_BEGIN|[30]|this|npsp.TDTM_Allocation|true|false
19:27:21.791 (792317588)|VARIABLE_ASSIGNMENT|[30]|this|{}|0x20fcfb1b
19:27:21.791 (819341451)|SOQL_EXECUTE_BEGIN|[50]|Aggregations:0|SELECT Id FROM Trigger_Handler__c LIMIT 1
19:27:21.791 (830309613)|SOQL_EXECUTE_END|[50]|Rows:1
19:27:21.791 (845906920)|SOQL_EXECUTE_BEGIN|[98]|Aggregations:0|SELECT Asynchronous__c, Class__c, Load_Order__c, Object__c, Active__c, Usernames_to_Exclude__c, Trigger_Action__c, User_Managed__c FROM Trigger_Handler__c ORDER BY Load_Order__c ASC NULLS FIRST
19:27:21.791 (864690602)|SOQL_EXECUTE_END|[98]|Rows:70
19:27:21.791 (891304524)|SOQL_EXECUTE_BEGIN|[1016]|Aggregations:0|SELECT Id, npsp__Payment__c, Payment__r.npe01__Payment_Amount__c, Payment__r.npe01__Paid__c, Payment__r.npe01__Written_Off__c, npsp__Opportunity__c, Opportunity__r.Amount, Amount__c, Percent__c, General_Accounting_Unit__c, Recurring_Donation__c, Campaign__c FROM Allocation__c WHERE ((Payment__c = :tmpVar1 OR Opportunity__c = :tmpVar2 OR Recurring_Donation__c = :tmpVar3 OR Campaign__c = :tmpVar4) AND Id != :tmpVar5)
19:27:22.981 (1981964897)|SOQL_EXECUTE_END|[1016]|Rows:49930

We are only updating one GAU Allocation record.

I suspect this is from https://github.com/SalesforceFoundation/NPSP/blob/e6ab6e5c5c095604ba8a024dac79351a94b59dce/force-app/main/default/classes/ALLO_Allocations_TDTM.cls#L1016

NPSP Version: 3.226

judisohn commented 1 year ago

Nope. Same limit, but completely unrelated context and use case.

The original poster is talking about an issue when an org that has custom scheduled jobs that are still considered actively queued and they're trying to load the NPSP Settings page and it fails because NPSP is trying to look at all the users Scheduled Jobs.

That has nothing to do with a query for Allocations.

rodolforicojr commented 1 year ago

Thanks @judisohn, I will post separate issue then.

judisohn commented 1 year ago

You can, sure, but no one who works for Salesforce is likely to respond. This is not where they track issues in the project. The only way to get Salesforce to look at the issue you're facing is to open a support case.