An Azure service for ingesting, preparing, and transforming data at scale.
Hi Deirdre Clark,
it turned out that your “Set exit message” never fires after the very first “Get ChangeOrderRequest” because ADF never sees that first call as a hard failure in your pipeline graph—so its Upon Failure branch never kicks in—and so the ForEach just marches on and invokes your web activity two more times.
Here’s the breakdown:
- By default a Web activity that returns any HTTP-status between 200 and 299 is considered Succeeded by ADF—even if your API payload says “Item not found.”
- Your “Set exit message” is wired to the Upon Failure output of the Web activity (or possibly to the parent ForEach’s failure), so if ADF doesn’t mark that call as Failed, that branch never executes.
- Because nothing actually “failed” from ADF’s viewpoint, the ForEach doesn’t stop and continues on to make the next two calls.
What to try next:
• Inspect your “Get ChangeOrderRequest” settings and see if the API is returning a 2xx status for “Item not found.” If so, ADF will treat it as success.
• If you want to trap a business-logic “not found” and set your exit message, either
– Adjust your API to return a non-2xx (for example 404), or
– Keep your API 200, but add an If Condition after the Web activity that checks
@equals(activity('Get ChangeOrderRequest').Status, 'Succeeded') AND
@contains(activity('Get ChangeOrderRequest').Output, 'Item not found')
and in the True branch do your Set exit message + skip the SP.
• Make sure you’re not using continueOnError:true on the Web activity—this will suppress a real failure and keep everything “Succeeded” in the run.
Let me know if you need any help wiring that up!
Reference list
• Troubleshoot pipeline orchestration and triggers in Azure Data Factory
https://learn.microsoft.com/azure/data-factory/pipeline-trigger-troubleshoot-guide
• How to check and branch on activity-level success and failure in pipelines
• Errors and Conditional execution in ADF
https://learn.microsoft.com/azure/data-factory/tutorial-pipeline-failure-error-handling
Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.