Rule registry · FL-021

No actions or subflows inside loops

Checked by the Salesforce Flow scan. Severity medium.

FL-021MediumPerformance

What it requires. Apex actions, invocable actions, email actions, and subflow calls must not appear inside a Loop element. This extends the ban on queries and DML in loops to every element that consumes per-invocation limits.

Why it matters. Flow bulkification batches executions of the same element across interviews, but an action inside a loop still executes once per iteration within each interview, multiplying Apex, email, and callout limit consumption exactly as DML in a loop does. A loop of 200 iterations calling an Apex action makes 200 invocations in one transaction.

How to fix it. Collect the required inputs into a collection inside the loop, then invoke the action or subflow once after the loop with the whole collection, or redesign the action to accept collections.

Source. Salesforce Help: Flows Bulkify Actions. Reference implementation: Lightning Flow Scanner, action-call-in-loop

Is this rule worth checking?

Votes and comments are published here. We read them, and we publish what we change with the reasoning — a vote does not move a rule on its own.

Every rule we check, every source, and every one we turned down