function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alex Waddell 17Alex Waddell 17 

Error: Too many SOQL Queries despite not using Loops in my Flow


I am receiving the following error when trying to create Accounts inside my Org. The error is being caused by a Flow that is fired by Process builder

Below is the error email sent to me:

Error element myRule_1_A1 (FlowRecordUpdate).
This error occurred when the flow tried to update records: Too many SOQL queries: 101. For details, see API Exceptions.

This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.

Flow Details
Flow Name: Assign_Escalation_Rule_on_Account_Creation
Type: Record Change Process
Version: 1
Status: Active

Flow Interview Details
Interview Label: Assign_Escalation_Rule_on_Account_Creation-1_InterviewLabel
Current User: Alex Waddell (0051N000005gBa1)
Start time: 4/17/2018 9:18 AM
Duration: 0 seconds

How the Interview Started
Alex Waddell (0051N000005gBa1) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = 0011N00001KCyB4QAL

ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
{!myVariable_waitStartTimeVariable} = "4/17/2018 9:18 AM"

DECISION: myDecision
Executed this outcome: myRule_1
Outcome conditions: and
1. {!myVariable_current.RecordTypeId} (0121N000001hHngQAE) Equals 0121N000001hHngQAE
Logic: All conditions must be true (AND)

Find all Account records where:
Id Equals {!myVariable_current.Id} (0011N00001KCyB4QAL)
Update the records’ field values.
Escalation_Rule__c = a0E1N00000EanvrUAB
Failed to update records that meet the filter criteria.

Error Occurred: Too many SOQL queries: 101

Below is a picture of my Flow and each node.

User-added image
First, I queried the Account ID and Zip Code on the Account
opUser-added image
Then i Lookup the Area that has a matching Name to the ZIP (so if a patient is in 75081, the Area record is called 75081) and collect the ID of the Area
User-added image
Finally, I call for an update of the Area__c lookup field on the Account and place the AreaID into that field
User-added image

I then fire the flow from a Process in Process builder where I set the variable varAccountID as the Account.Id

User-added image

I am at a complete loss on why this is causing a failure on import. I would really love an explanation of what is happening so I can build future flows to account for this type of thing

It seems you need to use fast lookup instead of record lookup