Apply to each (looping through arrays/lists)
Unlock the Power of Loops in Power Automate: Master “Apply to Each” for Seamless List Processing
Main Title: apply to each Power Automate
Secondary Title: Power Automate loop, process arrays, iterate over list
Table of Contents
- Introduction to “Apply to Each”
- What Is “Apply to Each” in Power Automate?
- Why Use Loops in Flows?
- Core Components of “Apply to Each”
- How to Set Up an “Apply to Each” Control
- Using Dynamic Content Inside Loops
- Real-World Use Cases of “Apply to Each”
- Nested Loops and Advanced Scenarios
- Expressions Inside “Apply to Each”
- Performance Considerations
- Common Mistakes to Avoid
- Best Practices and Optimization Tips
- Final Thoughts
1. Introduction to “Apply to Each”
When building workflows in Power Automate, processing multiple records — such as emails, list items, or array values — is a common need. That’s where “Apply to Each” shines.
This control is your go-to solution for iterating over a list, array, or collection, allowing you to execute actions on each item, one at a time. Whether you’re automating document approvals or looping through Excel rows, “Apply to Each” in Power Automate lets you scale your flow’s logic across dynamic data.
2. What Is “Apply to Each” in Power Automate?
The “Apply to Each” control is essentially a loop that allows you to perform actions for every item in an array or list.
For example:
- You receive a list of tasks from a SharePoint list.
- You want to send an email reminder for each overdue task.
Instead of repeating your logic manually, you wrap it inside an Apply to Each loop, and Power Automate automatically processes each entry.
3. Why Use Loops in Flows?
Loops are essential when:
- Handling multiple records from Excel, SharePoint, Outlook, etc.
- Sending individual messages or updates per list item
- Performing repeated validations or calculations
- Collecting data to compile into a report or summary
Using Apply to Each makes your automation scalable, dynamic, and intelligent.
4. Core Components of “Apply to Each”
Let’s break down how this control works:
Component | Description |
---|---|
Input Array | The list or collection to loop through (from dynamic content or expression) |
Current Item | Represents the single item being processed at that point in the loop |
Loop Body | Actions executed on each item (like condition checks, updates, etc.) |
Each time the loop runs, the Current Item changes to reflect the specific element in the array — allowing dynamic content inside to refer to that particular item.
5. How to Set Up an “Apply to Each” Control
Basic Steps:
- Trigger your flow (e.g., when a new email arrives or list is updated).
- Add the Apply to Each action.
- Choose the array or list to iterate over (e.g.,
value
from a SharePoint “Get items” action). - Add one or more actions inside the loop that operate on the Current Item.
Example Scenario:
- Trigger: A new SharePoint list item is created.
- Action: Get related tasks (array).
- Apply to Each: Send Teams message for each task.
This setup ensures that each related task gets processed individually.
6. Using Dynamic Content Inside Loops
One of the most powerful aspects of Apply to Each is how it handles dynamic content.
Let’s say you’re looping over tasks:
- Inside the loop, you can use fields like
Task Name
,Due Date
, orAssigned To
. - These values change for each iteration, making the loop context-sensitive.
Tip:
Be careful when using dynamic content from outside the loop — it may stay static unless explicitly pulled into the loop context.
7. Real-World Use Cases of “Apply to Each”
📩 Email Notifications Per User
- Source: Excel table with names and emails
- Loop: For each row, send a personalized email.
🧾 Invoice Processing
- Source: PDF form with line items
- Loop: For each item, calculate total and apply tax logic.
✅ Task Management
- Source: SharePoint list of incomplete tasks
- Loop: Send reminders for overdue items.
📊 Row Aggregation
- Source: Excel rows
- Loop: Gather totals and generate a summary at the end.
🧠 AI-Powered Text Analysis
- Source: Emails or survey responses
- Loop: For each item, run through AI sentiment analysis.
8. Nested Loops and Advanced Scenarios
Yes — you can nest Apply to Each controls within each other.
Use Case: Customer > Orders
- Loop through customers.
- For each customer, loop through their order list.
- Process each order based on value or delivery status.
⚠️ Note: Nested loops can slow down your flow significantly if the arrays are large.
9. Expressions Inside “Apply to Each”
Inside loops, you often need to use expressions to:
- Access nested fields
- Handle nulls or blanks
- Build complex logic
Example 1: Access nested field
items('Apply_to_each')?['OrderAmount']
Example 2: Use condition inside loop
if(greater(items('Apply_to_each')?['Amount'], 1000), 'High', 'Low')
This flexibility is what makes Power Automate programmatic without code.
10. Performance Considerations
⚙️ Key Points:
- Parallelism: You can enable parallelism to speed up loops. Be careful with dependencies.
- Loop Limits: Free/Standard plans have throttles. Long loops may require premium plans.
- Timeouts: Long-running loops can time out. Avoid unnecessarily large arrays.
Optimize by:
- Filtering data before the loop
- Using Select and Filter Array actions
11. Common Mistakes to Avoid
Mistake | Fix |
---|---|
Using wrong array as input | Always use dynamic content that returns an array (e.g., value from “Get items”) |
Referencing fields incorrectly | Use items('Apply_to_each')?['FieldName'] |
Looping over single value | Ensure you’re not feeding a single record into the loop |
Forgetting to handle nulls | Use coalesce() or empty() to avoid errors |
12. Best Practices and Optimization Tips
🧠 Tip 1: Use Pre-Processing Actions
Filter arrays or format data before entering the loop to avoid extra logic inside.
⚙️ Tip 2: Use the “Select” Action to Reshape Data
Clean and map data before looping.
🔁 Tip 3: Turn On Concurrency (When Safe)
You can enable parallelism inside loop settings for speed — ideal when loop iterations are independent.
💡 Tip 4: Track Progress
Store loop outputs or errors in a variable array or SharePoint list for logging or debugging.
📈 Tip 5: Avoid Nested Conditions Inside Loops
Use expressions or pre-calculated logic to avoid bloating your loop with heavy decision trees.
13. Final Thoughts
Mastering the “Apply to Each” loop in Power Automate gives you the power to handle complex, repetitive tasks with ease. It opens doors to intelligent automation, letting you process multiple items with logic, flexibility, and efficiency.
Whether you’re a business analyst, IT admin, or citizen developer — if you deal with arrays, lists, or tables, learning how to use loops effectively is a must-have skill.
Frequently Asked Questions (FAQs)
Q1: Why does Power Automate automatically add an “Apply to Each”?
Because the selected dynamic content is array-based. It needs a loop to process each item individually.
Q2: Can I use nested loops?
Yes — but avoid excessive nesting due to performance concerns.
Q3: How do I break out of a loop early?
Power Automate doesn’t have a built-in “break” command. You can simulate this using a Condition and Terminate action.
Q4: Is it possible to combine loop output?
Yes. Use Append to array variable to gather output across iterations and use later in your flow.
Want This Guide as a PDF, Word Document, or Blog Post?
Let me know — I can format it accordingly for publishing or distribution.
Would you like to move on to another Power Automate topic like “Filter Array”, “Do Until”, or “Switch” control?