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 

Help! Exceeding Iterations in a loop. Is this avoidable or do i need an apex solution?


I have created a flow using Fast lookups and Fast Creates to try and create a "Service__c" record for every "Service_Plan__c" where the Status__c = "On Service"

I got the flow to work on a small test batch but when I step the number of records to 3000, I am getting the following error

Error element Loop_Through_Service_Plans_0 (FlowLoop).
The number of iterations exceeded

Is there any way to avoid exceeding these limits while still using flows? Or do I have to develop an apex solution?

Below is a screenshot of my flow and some information on what it does

User-added image

Flow Details
Flow Name: Generate_Services_for_Billing
Type: Autolaunched Flow
Version: 8
Status: Active

Flow Interview Details
Interview Label: Generate Services for Billing 5/21/2018 3:21 PM
Current User: Alex Waddell (0051N000005gBa1)
Start time: 5/21/2018 3:21 PM
Duration: 6 seconds

How the Interview Started
Alex Waddell (0051N000005gBa1) started the flow interview.

FAST LOOKUP: Find_Service_Plans
Find all Service_Plans__c records where:
PERS_Status__c Equals On Service
Assign those records to {!collection_Service_Plans}.
Save these field values in the variable: Id, ICD_10__c, Current_Price__c, Payer__c, Billing_code__c, Modifier_NPI__c, Modifier_Tax_Id__c, Service_User__c
Successfully found records.

LOOP: Loop_Through_Service_Plans_0
Loop Through: [a061N00000QwTC3QAN,a061N00000QwTC4QAN,a061N00000QwTC5QAN,a061N00000QwTC6QAN,a061N00000QwTC7QAN,a061N00000QwTC8QAN,a061N00000QwTC9QAN,a061N00000QwTCAQA3,a061N00000QwTJOQA3, (This continues for a long time, did not want to enclude in this thread) 
Narender Singh(Nads)Narender Singh(Nads)
Hi Alex,
You are hitting the flow limit.
The number of executed elements at runtime per flow is 2000. Refer this documentation:

You should build a apex solution for your requirement.

Let me know if it helps.