Notes
In Salesforce Flow, loops are used to iterate through a collection of records or items and perform actions on each item. You can loop over records retrieved by a Get Records element or a collection variable.
Best practices for using loops:
- Avoid performing DML operations inside loops to prevent hitting governor limits. Instead, gather data in a collection and perform a bulk DML operation after the loop.
- Use collection variables to handle large sets of records efficiently and minimize the number of iterations.
- Limit the loop's complexity by keeping the logic inside simple and focused on the necessary actions.
- Test the loop with bulk data to ensure it performs as expected without hitting limits.