Forum Discussion
Azure Data Factory ForEach Loop Fails Despite Inner Activity Error Handling - Seeking Best Practices
The key detail is how ADF determines the result: it evaluates the leaf activities in the dependency graph. With both Success and Failure branches, the skipped success branch can cause the failed Web activity to be evaluated, so the ForEach still fails.
A cleaner pattern is:
1. Put Sample_put_record first.
2. Connect it to a single If Condition using Upon Completion, not Success/Failure.
3. In the condition, check @equals(activity('Sample_put_record').Status,'Succeeded').
4. Log success in True and log failure in False.
If either logging Script fails, that iteration will still fail, so make those logging steps reliable or add their own best-effort handling. Also inspect the failed iteration in Monitor to confirm which inner activity is the actual leaf failure.
There is no general Continue on error switch on ForEach. If you prefer the direct-branch design, use the Do-If-Skip-Else pattern; otherwise the Upon Completion plus If pattern is usually easier to reason about.