This is a flow that updates Primary PCA (Lookup to User in Opportunity), Opportunity Owner and Contact Owner. It is looking for these conditions:

  1. IF High School (Account) has a Primary PCA (User lookup in Account) => runs the updates IF NOT

  2. THEN Get all Users where Home Campus on User EQUALS $Record.Home Campus (Text field on Opportunity)

  3. Loop through all retrieved Users to see who has the smallest number of open Opportunities assigned to them

  4. Gets all Opportunities where User is Primary PCA AND Stage = Lead OR Applicant OR Enrolled-Not Paid

is giving me the error Too many query rows: 50001, for 7500 of about a 53k upsert of Opportunities when going through this loop.


The flow above works in tandem with this flow below:

error 2

This Flow Flags an Opportunity (Checkbox = True) on creation if Stage = Lead/Applicant, Primary PCA = null and other conditions.. This Flow uses a scheduled path to wait 5 minutes after being triggered to set the flag because there may be additional automation (flow/apex) that kick in after an Opportunity is created that continue to update the Opportunity.

The flow is giving me the following error: This interview has been terminated as another interview in the same bulk execution request failed with the following error: An unhandled fault has occurred in this flow.

Anybody know if these issues can be solved? Anything I can change to the flow? Any help is much appreciated.

Thank you.

  • 2
    to start with, you are doing a Get Records element in a loop which is not best practice. Refactor your flow to avoid this
    – cropredy
    Sep 25 at 18:25
  • @cropredy Thank you for the tip! This is something that our vendor built for us before they left and I am unsure on how to get rid of the get records inside the loop. Do you have any ideas on how I could do it? Thank you. Sep 25 at 18:37
  • in general, use a loop to build a collection of keys/ids to use in a single Get Records outside of the loop. This is application dependent. Check also to make sure the query filters are accurate (especially when a value might be null - as that can bring back a lot of records in some apps).
    – cropredy
    Sep 25 at 18:41


You must log in to answer this question.

Browse other questions tagged .