Individual/Bucket Account Model: Post-Winter 22 users getting a System.LimitException: npsp:Too many query rows: 50001 when merging contacts or other unexpected behaviour
jamesbsfdc opened this issue · 2 comments
Background
The recommended account model in NPSP is the household model however other account models are possible. See: https://powerofus.force.com/s/article/NPSP-Legacy-Account-Models.
Under the Individual Account Model, often referred to as the bucket account model, all Contacts are associated with a single Account instead of household accounts. This account is usually called "Individual."
Issue Summary
NPSP 3.209 included some refactoring work for accounts and contacts which introduced a bug that occurred in certain situations when contacts using account models other than the household account model are deleted. This bug is detailed here: #6755
If you are using the Individual Account Model in particular you may experience this bug if a few different ways. As detailed under the existing bug above, one scenario under which you encounter this bug is when two or more contacts from bucket accounts are merged. This will result in the bucket account of the master contact being renamed to Anonymous Household.
Additionally, if a bucket account contains a high number of contacts you may experience system limit errors when you attempt to merge two or more contacts in the account, or across bucket accounts. The exact number at which you hit the system limit can vary depending on data shape but will occur if the bucket account(s) contain anywhere from 25,000 contacts or less. In this scenario the error received will be "System.LimitException: npsp:Too many query rows: 50001".
Note: Associating more than 10,000 contacts to the same account is not recommended for data skew and performance reasons. As a result you may want to create multiple bucket accounts to split one large bucket account into multiple smaller ones.
Steps to Reproduce
- Change the Account Model to Individual
- Create a dataset of 25,000 contacts
- Insert 25,000 contacts
- Confirm they are all associated to the same account in Salesforce, called Individual
- Merge 2 of the contacts
- Confirm you hit the limit of query rows
Workaround
If viable, reparent the contacts you are trying to merge to another temporary account, merge the contacts and then reparent the master contact back to the original bucket account.
e.g i.e if you have 2 contacts you want to merge, contact A and contact B, both associated to a bucket account, account X, create a temp bucket account, account Y, move contact A and contact B to account Y, merge the contacts and then move the merged contact back to account X
W-10227258
This issue should be fixed with #6767