How to send an exception to multiple user email based of the error

Hi - I need a design solution , I am using RE framework to automate multiple reports for multiple users.

if in case of exception, I just need to send exception email only to the specific user not other’s - how we can achieve this and do I need to have exception email trigger inside the process transaction ?

FYI, To process each report , I using switch case activity

any suggestion please.

1 Like

Maybe you can create custom properties for your exception. Example: In the catch block you can create an exception property using an assign activity exception.Data(“EmailToTag”) = “SupplierTeam” or exception.Data(“EmailTo”) = in_config(“supplierEmailAccount”).ToString


then you can trigger the email in the SetTransactionStatus in the “Business Exception and SystemException” sequences
image
If you want to use the tag property then you can use an expression like this in the Switch activity:
If(exception.Data(“EmailToTag”) IsNot Nothing AndAlso exception.Data(“EmailToTag”).ToString.Contains(“SupplierTeam”),
“SupplierTeam”,
“Default”)
Above expression will evaluate first if the attribute “EmailToTag” exists, if exists then will check if “EmailToTag” contains “SupplierTeam”, in the “SupplierTeam” case of our switch activity you can have an assignment to build your distribution list
Else, if you want to use “EmailTo” ,then in the SendEmail activity you can just have this If(exception.Data(“EmailTo”) IsNot Nothing,exception.Data(“EmailTo”).ToString,in_config(“defaultEmailAccount”).ToString)
In case that the property “EmailTo” it will use the value coming on that property else will use a default value

Hi @monishanair2010
As you mentioned you are using Re framework.
Nothing to do much except few steps.
Make a separate list of emails in config file where you want to send email.

Now go to setTransectionStatus and open Businesses Exception and put Send mail activity.
Where put that you maintained in config. You can attach screenshot as well.

Repeat same steps for System Exception.

Happy automation

@monishanair2010

What you can do is …to send report to different users you need to know which report case failed…

So for that in your switch case activity use a set asset activity and set the report name you are using or if you have the emil id of the person concerned with report add that email id to the asset…

And when there is an exception…in the catch block of the process xaml in re framework …use a get asset on the same asset where you added the report name/email id and get the value and then use it in the send email activity…if email is added then the body and all would be same and you would use the retrieved asset value to send the email to respective email ids…if a report name is retrieved then you need to first lookup the value of email id to which the mail is to be sent either from the config file or a mapping file containing the details and use it in the email

Hope this helps

Cheers

Hi @monishanair2010,

To achieve sending exception email only to the specific user, you can follow these steps:

  1. In the Config file, add a column for “UserEmail” and provide the email address of each user for whom the reports are being generated.
  2. In the Process.xaml file, use the “GetTransactionData” state to read the transaction data from your data source.
  3. For each transaction, use the “Switch” activity to identify the user for whom the report is being generated. You can use the “UserEmail” column in the Config file to identify the user.
  4. When an exception occurs, use the “Try-Catch” activity to catch the exception and send an email only to the user for whom the report is being generated. You can use the “UserEmail” column to get the email address of the user.
  5. To achieve this, you can create a separate “Send Email” activity that will only trigger when an exception occurs. The email body can include the details of the exception and can be customized for each user.
  6. To ensure that only the exception email is sent to the specific user, you can use a flag in the transaction data to indicate whether the email has been sent or not. This flag can be updated after the email has been sent to avoid sending the email multiple times.
  7. You can also log the details of the exception in a separate log file or database for further analysis.