Advanced 20 min read

Bulkification and Error Handling in Flow

By the end of this lesson, you'll be able to:

  • Explain why Get Records and DML-style elements should not sit inside a Loop
  • Add a Fault Path to handle an element's potential failure gracefully

Prerequisites: Formulas and Variables in Flow

Bulkifying a Flow

The same governor-limit lesson from Apex applies to Flow — a Get Records or Update Records element placed inside a Loop runs once per loop iteration, and at high volume this can exhaust SOQL/DML limits exactly like unbulkified Apex would. The fix is the same shape too: collect everything needed into a collection variable first, then perform one bulk operation outside the loop.

Fault Paths

Any element capable of failing — Create Records, Update Records, an Action calling Apex or an external system — has an optional Fault Path. Connect it to handle the failure explicitly (log it, notify someone, show a friendly screen) rather than letting the Flow fail with a raw, user-hostile error message.

The bulk-safe restructuring pattern

Anti-pattern: Update Records element placed INSIDE a Loop
  -> one DML statement per loop iteration, hits limits at scale

Bulk-safe pattern:
  Loop -> Assignment (add updated record to a collection variable)
  -> (after the loop ends) one Update Records element on the whole collection

This mirrors exactly the SOQL/DML-inside-a-loop lesson from Apex — collect changes during the loop, then perform a single bulk operation once, outside it.

Exercise

A Flow currently has an Update Records element inside a Loop, updating one Contact at a time. Describe how you'd restructure it to be bulk-safe.

Show hint

Think about what should move outside the loop, and what should happen inside it instead.

TEXT

Bulkification and Error Handling in Flow — Quick Check

1. What happens when an Update Records element sits inside a Loop processing 200 records?

2. A Fault Path lets a Flow handle an element's failure gracefully instead of erroring out with a raw message.

3. What is the bulk-safe pattern for updating records processed inside a Loop?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

Just like Apex, a Flow's Get Records, Create Records, or Update Records element placed inside a Loop runs once per iteration and can hit governor limits at scale — and any element that can fail should have a Fault Path connected, so the Flow degrades gracefully instead of erroring out for the end user.