Execute a Task when a Package Fails

  • I have a custom task that I want to fire when a package fails. Is there an easy way to do that, other than dragging all of the "Fail" paths from the different tasks to that custom task?

    Thanks,

    Michael

  • Click on the "Event Handlers" tab.

    Be aware that if you put something in the OnError event handler for a package that it will be fired multiple times if something within a container errors.

  • I will check that out. Thanks!

  • I see what you were saying about it firing for each task that fails in the package.

    I am going to go out on a limb and see if anyone knows of a way I can get it to only fire once when the package fails?

    Thanks,

    Michael

  • On each component, there is a "Fail package on failure" property that you can use to manage (to some degree) when event handlers will and will not fire. It gets pretty tricky since you want the package to fail, but you do not want to go through the failure event.

    Usually, I add a boolean variable to indicate if my event handler tasks have been run. I do not run the tasks if the variable has been tripped and then I just trip the variable at the end of the event handler. I hope you followed that.

    One eay approach is to add an empty sequence container to the event handler. Drag that connector from the sequence container to your component. In the connector, check the boolean variable. After your component, set the variable to true. There is probably some "Error Count" variable that you could probably check, but I have not spent the time to find one yet.

  • Michael,

    That worked beautifully. Thank you!

    Michael

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply