In Salesforce Nonprofit Success Pack (NPSP), you may encounter an error like npsp.TDTM_Contact: System.LimitException: Too many SOQL queries: 101, while updating a Contact's address which is part of a Household Account.
This error typically occurs, if there are a large number of Contacts (for eg: more than 50) associated with the same Household Account, causing Salesforce to exceed its SOQL query limits when performing updates.
Why This Happens:
(i). Group the contacts to appropriate Household Account to ensure huge number of contacts are not associated under single Household Account and try to update the contact's address in NPSP.
(ii). If custom code is used, The error "Too many SOQL queries: 101" occurs when the number of SOQL queries executed in a single transaction exceeds the governor limit of 100. Here are some steps you can take to resolve this issue:
1. Review and Optimize SOQL Queries:
- Ensure that your code is not making unnecessary SOQL queries within loops.
- Use collections (like lists, sets, or maps) to store data and reduce the number of queries.
- If you need to change the context, you can use @future annotation which will run the code asynchronously.
2. Disable Unnecessary Triggers:
- If there are triggers that are not required for your operation, consider disabling them temporarily.
3. Batch Processing:
- If you are processing a large number of records, consider using batch processing to handle them in smaller chunks.
Best practices to avoid exceeding the Governors Limit:
Since Apex runs on a multi-tenant platform, the Apex runtime engine strictly enforces limits to ensure code doesn't monopolize shared resources.
For more detailed information, please refer to the following documentation: https://help.salesforce.com/s/articleView?id=000386220&type=1
004575675

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.