About EasyMorph Tutorials & Examples Web-help

Sending an email notification when project fails


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:

  1. Save both projects into a folder.

  2. Open “master.morph” and configure the embedded email connector in it, and the “Send email” transformation (connector, recepient, etc.).

  3. Set the parameter “Should fail” to NO and run the project. It should run project “can fail.morph” and complete successfully, without email notification sent. Column “Iteration errors” is empty.

  4. Set the parameter “Should fail” to YES and run the project again. Project “can fail.morph” 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 iterated project using a parameter, the master project can be reusable – provide it with a project to run and a message text to send.

master.morph (3.9 KB)
can fail.morph (1.5 KB)