Send an outlook message if the process ended correctly

Hello everyone!

I have a robot that runs automatically every day, I want it to send me a message to the outlook saying if the process has been executed correctly or if there has been any failure, so I don’t have to be looking at it. I suppose I have to do it with an “if else” but I don’t know how.

Can someone help me?
Thanks! :slight_smile:

are you using REFramework?

if not you can start with something like this

put your process in try-catch statement (so it can also handle unhandled exceptions). at the end of try catch use if-else , if success status = “success”, otherwise status=“Failed”

in “catch” section you can assign status=“Failed” and also print out exception message using exception.Message
image

then after try-catch use send outlook mail message and include the status from above

1 Like

Hi!
I don’t really know what to put in each part, I get errors and I don’t know what to put in “condition” either.

Sorry I think I need more details.

Hi!
In the end I managed to do it with an if else as follows:


And with the following activity:
image
Now I want to declare the “recipient to” as an asset from the orchestrator, and I want it to contain multiple emails, can someone help me with that?

create asset in orchestrator


separate multiple emails using (;)
email1@gmail.com;email2@gmail.com

then use get asset activity and pass in the asset name to get value of this asset

1 Like

That’s what I’ve done, but I get this error:

it says your recipient list is empty, did you use “get asset” before? and output the result of “Get asset” to in_outlook? , also in_outlook should be a string, not an array of string
image

1 Like

Yes @jack.chan , I used a “get asset” and put the result into in_Outlook. Also if I put in_outlook as a string I get this error:

1 Like

sorry, change it back to String, and please do this

  1. get asset to string variable

  2. use assign activity
    in_outlook = assetValue.Split(";"c)

  3. pass in_outlook to send mail activity recipient list

1 Like

@jack.chan I can’t do the assign because I created the variable in the Main and the argument is in another workflow. So the variable assigned to that asset, which is “MailsList” does not appear in the list of my variables.

you can create an argument, “in_AssetValue”,
then asset result of “get asset” to in_assetValue when you invoke the workflow

1 Like

Here you can use some flag values. Use Try catch activity.

In the try stage, initially set the value for eg: status="False"And at the end of the Try, set the value as “Success” . Then in the finally stage of Try catch you check the status of Status, if it “Success”, then send the email using Send Outlook mail message.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.