If you ever need to send an email notification in case of project failure here is how you can do it:
The example below uses a new setting in the “Iterate” transformation that allows catching errors in the executed project: “Collect errors and continue”. Therefore, in order to capture error of a project we need to iterate the project once in a wrapper (master) project, capture errors in “Iterate”, and if there are errors – use a conditionally derived table to run the “Send email” action.
Here is how to use the example:
-
Save both projects into a folder.
-
Open “email-on-failure.morph” and configure the embedded email connector in it, and the “Send email” transformation (connector, recepient, etc.).
-
Set the parameter “Should fail” to NO and run the project. It should run module “Submodule” and complete successfully, without email notification sent. Column “Iteration errors” is empty.
-
Set the parameter “Should fail” to YES and run the project again. Module “Submodule” should fail, which produces an error value in “Iteration errors” column. This activates table “When failure” and executes “Send email” in it.
Bonus tip: Since “Iterate” allows specifying the iterated project using a parameter, the master project can be reusable – provide it with a project to run and a message text to send.
UPDATE 5/12/2021
The example has been updated to use features available in the latest version. Also added a 2nd group (tab) that shows an alternative solution using the “Skip” action.
email-on-failure.morph (8.9 KB)