Iterate through a list of items one by one — applying business logic, calling APIs, and making decisions per item. The simpler cousin of Fan-Out/Fan-In for smaller collections.
Rendering diagram…
Use a looping processor when:
For larger collections or items that can be processed independently, see Fan-Out / Fan-In or Scheduled Batch Processor.
items = get_collection() // [item1, item2, item3, ...]
results = []
errors = []
FOR EACH item IN items:
try:
result = process(item)
results.append(result)
catch error:
errors.append({ item, error })
IF error.is_fatal:
BREAK // Stop on critical error
ELSE:
CONTINUE // Skip and move to next
generate_summary(results, errors)
Sources for your item list:
| Source | How to Retrieve |
|---|---|
| SharePoint list | Query list items action |
| Database | SQL query |
| Excel/CSV | Parse file into rows |
| API response | Call web service, parse response array |
| Repeating section | Read form collection data |
| Manual list | Comma-separated text field |
For each item in the collection:
| Strategy | When to Use |
|---|---|
| Skip and continue | Non-critical items; collect errors for review at the end |
| Stop on first error | Items are dependent on each other; processing out of order would cause data corruption |
| Retry and continue | Transient errors (API timeout); try once more before skipping |
| Accumulate errors and stop at threshold | OK to skip a few, but if >10% fail, something is systemically wrong |
Common causes and safeguards:
| Risk | Safeguard |
|---|---|
| Loop counter not incrementing | Set a max iteration cap (e.g., 500) |
| Exit condition never met | Add a timeout (e.g., 30 minutes total run time) |
| Item reappears in collection | Track processed IDs and skip duplicates |
| Workflow triggers itself | Add a "processed by workflow" flag to items |
After the loop completes:
| Metric | Value |
|---|---|
| Total items | 47 |
| Processed successfully | 44 |
| Skipped (validation) | 2 |
| Failed | 1 |
| Processing time | 3m 12s |
| Error details | Item #23: "Vendor API returned 404 — vendor not found" |
If your loop takes more than 5 minutes, consider whether you can parallelize with Fan-Out/Fan-In instead. The break-even point is usually around 20 items or when per-item processing exceeds 15 seconds.
Split a workload into parallel branches, process them simultaneously, then aggregate the results. Dramatically reduces processing time for batch operations.