I am trying to build a flow that will loop through a certain subset of records and sum the field values from their records.
In most cases, the subset of records that the loop runs through is 200 - 800 records in size and this works perfectly. But I do ocasionally have instances where the record set contains 1,500 - 2,000 records and that is driving the "Number of iterations exceeded" error.
After doing some research I learned that this can be avoided by breaking loop/assignement/update sequences into smaller batches per this topic: https://success.salesforce.com/answers?id=90630000000DGc4AAG
Following this advice, I created a custom field on my object that is being looped through so that I can filter on it in the Fast Lookup and break the record set into batches. However I am still getting the error. Do I have an issue with the way my flow is structured?
I replicated the record set that is throwing the error in a report to demonstrate how it is batched out, here it is below:
1,561 total records, but separated into three batches of around 550 records each. I have three loop/assignement/update sequences each of which start with a Fast Lookup that is filtered by "Revenue Batch".
Here is my flow:
And here is my Fast Lookup Criteria:
The "Revenue_Batch__c" filter is set t0 "Batch 2" and "Batch 3" on subsequent steps.
In each loop, the value of a field called "Price__c" is added to a variable called "RevenueCount", and then at the very end a single record is updated with the value of "RevenueCount".
Should I structure this differently so that I don't recieve this error?
Thanks so much for any help!!
John
2 respostas
I too am interested in finding a solution for this. The help article referenced by Ed Ruzol only explains the eror not how to resolve it. In thinking about this further, I could be wrong but I believe that the issue is with the fast lookup. It looks up all records that meet the criteria. If you have a lot of records that meet your criteria and there is no way to limit the records in the fast lookup then you need to move to apex. Please vote for this idea - https://success.salesforce.com/ideaView?id=08730000000Dq2oAAC