Else being executed same statement being true

Hello,

I’m having problems with ElseIF from this automation. It checks if the outlook is open, if it is sending an email, if it is not running Retry Scope by initializing the outlook, however the retry scope is executed even when the first if is attended. Can someone help me?
Outlook.xaml (17.6 KB)

Easiest way to check your if statements is to add a write line activity for each one. I went through and every time I saw an if statement I add write line: “first if true” or “first if false”, then for the 2nd if I did the same thing: “second if true” or “second if false”.

When I ran it, I followed the 1st false branch, then the 2nd false branch (which throws an error).

Note that I do have outlook open and running, so you may want to check your conditions. I don’t think you’re properly finding the “OUTLOOK” string. Your current line of
Processos.toString.contains(“[System.Diagnostics.Process (OUTLOOK)]”)

Will just show the string “System.Collections.ObjectModel.Collection`1[System.Diagnostics.Process]” so searching if it contains “OUTLOOK” will always be false.

Since you’re saving running processes as a collection, you should first use the “Exists in Collection” activity and search for OUTLOOK. This will output a boolean which you can then use in the first IF statement

2 Likes

Hi @Dave,

Thanks. I’ll review it again by applying your tips. We will see what will happen.
:slight_smile: