exit inside if activity

arkiboys 9,691 Reputation points
2022-02-16T08:16:36.22+00:00

Hi,
In the pipeline, there is an if activity
If the condition is true, then using the fail activity it fails the if activity and so the pipeline fails.
If the condition is false then the pipeline continues to the next activity...

Question:
How is it possible, when the if activity fails (As mentioned above) then I want the pipeline to end and not continue to the next activity and so the pipeline succeeds.
Thanks

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,587 questions
0 comments No comments
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,462 Reputation points Microsoft Employee
    2022-02-17T02:51:30.983+00:00

    Hello @arkiboys ,

    Thanks for the question and using MS Q&A platform.

    My understanding is that you are having an IF condition activity in which you check for a condition and based on the condition outcome you will have a fail activity in TRUE path (if condition is true) and some other flow of activities in the FALSE PATH of the condition. But as you are having Fail activity in TRUE path and when the flow enters TRUE path your fail activity gets executed which inturn fails the pipeline. But you want to avoid pipeline failing. Please correct me if I'm not accurate.

    If you want to avoid your pipeline failing because of fail activity, I recommend avoid using Fail activity in the TRUE Path, instead you can have a set variable activity with some Custom message set for the variable. This way you can avoid the pipeline failure when the flow takes the TRUE PATH. And if the flow takes the FALSE PATH, it will continue executing your subsequent activities inside the IF Condition activity.

    In case if you have few more activities outside of the IF Condition activity, and you still want to use fail activity but discontinue the subsequent activity execution up on fail activity execution but make the pipeline run successful, then you may have to design your activity flow (based on the success/failure dependency) as TRY-CATCH method as described in the below articles:

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.