Set Property ForeExecutionResult of a Task to Skip Error of a Task within a Package

I have a need to send email alert when an FTP job task with WinScp generates error(s) but I still want the workflow to continue.
I have created an Event Handler for OnError event to retrieve a variable from the FTP task to send dbmai through an Execute SQL Task:
EXEC msdb.dbo.sp_send_dbmail

I can set the property “ForeExecutionResult” of the FTP task to Success to continue the job.
Within the FTP job I use

 if (winscp.ExitCode != 0)
                    Variables lockedVariables = null;
                    Dts.VariableDispenser.LockOneForWrite("ConcatenatedError", ref lockedVariables);
                    lockedVariables["ConcatenatedError"].Value = "XX GM FTP File Error!";

                    Dts.Events.FireError(0, lockedVariables["ConcatenatedError"].Value.ToString(), "FTP Error", String.Empty, 0);


to trigger the OnError Event Handler and pass a value to the SSIS variable to be consumed for dbmail.
I have a series of 8 FTP tasks and the code can send email out only for those that are running into problems and the package will continue to finish.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s