Foreach
The Foreach activity iterates over a collection of dimension members, executing a subprocess for each item independently.
Purpose
Use the Foreach activity to:
- Process multiple members in a loop
- Execute the same operations for each element in the collection
- Handle batch processing scenarios

Behavior
Iteration Model
- Subprocess-Based: Built on the Subprocess activity
- Independent Instances: Each iteration is treated as a separate subprocess instance
- Parallel Support: Iterations execute in parallel
- Collection Processing: Processes items from a dimension query
Structure
Foreach: [Collection]
└─ Subprocess Instance (for each item)
├─ Activity 1
├─ Activity 2
├─ ... ... ...
└─ Activity N
Usage Notes
- Each iteration has its own execution context
- The subprocess template is reused for each item
- Items are processed independently
- Progress tracking shows status of each iteration
Common Patterns
Multi-Entity Operations
Foreach: Account List
└─ Subprocess: Account Operations
├─ Validate Account
├─ Calculate Balance
└─ Generate Report
Comparison to Manual Loops
| Approach | Foreach Activity | Manual Loop Pattern |
|---|---|---|
| Setup | Built-in | Requires custom logic |
| Clarity | Clear intent | Requires interpretation |
| Maintenance | Easier | More complex |
| Error Handling | Per-iteration | Manual implementation |
| Progress Tracking | Automatic | Manual logging |
When to Use
- Processing multiple records or entities
- When iteration logic is straightforward
- When you want clear visualization of iteration status
- When each item requires the same processing steps
- For batch operations with independent items