Skip to main content

KI-157

Account Search throws "Aggregate Query" error when restricted to the selected institution

Created date08/19/2026Updated date08/19/2026
StatusBacklogRelated work itemMSS-109
DescriptionA person search in Account Search might throw the following error when the Restrict To Selected Institution toggle is enabled:
"Aggregate query has too many rows for direct assignment, use FOR loop"



This is the same Salesforce query limitation described in KI-131, which Salesforce documents in the following articles:

- Aggregate query has too many rows for direct assignment but less than 200 rows
- "Aggregate query has too many rows for direct assignment, use FOR loop" Salesforce error

Root cause:
KI-131 addressed how Account Search reads the Contact Information and Affiliation records related to each search result. It did not change how Account Search retrieves the underlying query result itself, which is still assigned directly instead of being processed in a loop. As a result, the same Salesforce limitation can still be reached in V16 and later when both of the following are true:

1. There are long or rich text fields in the Account query and
2. The search retrieves a large number of related Contact Information or Affiliation records

Restricting a person search to the selected institution makes this more likely, because the search then also evaluates every account affiliated with that institution.
Affects version(s)V16, V17, V18Impacted capabilitiesInquiry Management
Steps to reproduce
  1. Open or create an Interaction.
  2. In Account Search, search for an institution that has a large number of affiliated Accounts, and add it to the Interaction.
  3. Switch to a person search.
  4. Enable the Restrict To Selected Institution toggle.
  5. Search for a person. The error appears instead of the search results.
WorkaroundThere are two possible workarounds for this issue:

1. Disable the Restrict To Selected Institution toggle and search for the person without it.
2. Remove user FLS to all long text and rich text fields on the following objects:

- Account
- Contact
- Contact Information
- Affiliation
Fix versionV19Resolution notes