I have a flow that loops through Opportunity Line Items. When the number of line items get large it get an error in my flow. The UI gives the following message "You or your organization has exceeded the maximum limit for this feature." But I am also seeing "Number of iterations exceeded" in the debug logs when I run the flow from the designer.

I have not seen any documentation on any iteration limits. I can loop through all of the line items(562) with a simple assign as the only element. But as I add other decision and other elements I get the error. With several elements in the loop I can only process less than 100 items. This is not acceptable for our use case.

Has anyone else seen this same error and limitation? Is there any consistency to it that you can develop around? Or are flow just truly not bulkified?

  • Have you tried running this within the developer console? Once you have the console open click Debug -> Switch Perspective -> Log Only which will clear up the log to the events you will be most interested in. My initial guess is that you are running into a SOQL limitation or may have a trigger that needs to be reviewed. In cases like this, there is a good chance that you need to review your method of accomplishing the task as there is most likely a cleaner way to implement. Let us know what Limit_Usage gets tripped in the dev console.
    – TC Sutton
    Feb 4, 2015 at 16:30
  • I know this was a while ago but did you find out anything? Yes, Ive had this problem multiple times and cannot find anything on iteration limits either and cannot find any rhyme or reason to them.
    – ddeve
    Apr 9, 2015 at 1:43
  • Ran into this as well, basically flows are only useful for very small simple use cases, anything else is better off as a trigger, far more scalable and easier to test and debug. I'm unimpressed with flows. May 19, 2016 at 20:14

1 Answer 1


I have also been running into the 'Number of iterations exceeded' limit. It seems to be the 'Maximum number of executed elements at runtime' limit that I am hitting (the limit is 2000, see the Salesforce documentation here: https://help.salesforce.com/apex/HTViewHelpDoc?id=vpm_admin_flow_limits.htm).

The reason this limit is hit is that when looping through records, each element in the loop counts as an executed element multiple times (once per record that you loop through).

For example, the simple loop below could process a maximum of 666 records:
the 3 elements in the loop * 666 = 1998 executed elements
+ fast lookup element = 1999 executed elements
+ fast update element = 2000 executed elements - the limit

Example flow

If you have additional elements inside your loop, the number of records you can process will be reduced accordingly. For example if there were four elements in my example loop, then the flow could only process (2000 - 2) / 4 = 499 records before hitting the limit. I've tested this using different numbers of records and different numbers of elements in the loop and this is definitely what was causing this error message for me. I would imagine this is also the limit you're hitting, as you say that it's adding extra elements that is reducing the number of records you can process.

I don't think that this limit is made clear enough in the Salesforce documentation, and for my purposes it makes flows essentially useless, as it seems that you can only ever loop through relatively small numbers of records using a loop.

  • I've run into this as well, one thing I'm trying to figure out is if this limit applies per flow in a transaction or if it is an aggregate of all flows that run in a transaction. I agree, it's not documented very well May 26, 2016 at 4:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .