How can I send a use mail in case of exception?


#1

is there a method to send a mail in case of exception found (any exception) in process flow. I am aware of Try Catch, what I am trying to understand is, is there a possibility that I write down a function, which will send a mail if the workflow is broken before the end?


#2

Hi, @MGDEL,

Use Send mail activity in Finally block of Try Catch activity. It goes through the Finally block in both exception and no-exception cases.

If you don’t use try catch you cannot handle the exception and send mail.

Thanks,
Vikas


#3
  1. Create a separate file containing ‘send outlook mail’ activity with all the fields configured except mail body. Create an argument of mail body.
  2. In your main workflow put try catch to the modules which can throw error.
    Now you can do two things:

a. In the catch, invoke the file (point 1) with argument mail body. append the exception message and your text in the mail body argument.

b. in the inner module catch you can re-throw the exception with the exception detail to the main try catch and do according to the point a. (in this way all the inner exception are handled at main try catch.)