Condition in a variable

I am using a complex if condition multiple times in a workflow. It’s always the same so I would like to put the condition in a variable for easier use. I’m not able to get it work and I believe the problem might be in the type of the variable. The condition is like this:
mail.Subject.Contains(“Invoice from xxx”) Or mail.Subject.Contains(“xxx invoice”)
I’m using it inside a loop which goes through the emails.
Have you solved this or are you using a different approach?
Thanks, Roope

Hi Roope!!
I believe you are using the right approach by using functions.
If you will like me to look through it and suggest any change I will be more than happy to do it.


Hi sarthakgulati13,
Thanks for your reply. Unfortunately I’m not allowed to share the files. I apologize for a not so clear question but I try again and maybe you know the answer: can I make variable like this to use in IF function’s condition slot:
variable1 = mail.Subject.Contains(“Invoice from xxx”) Or mail.Subject.Contains(“xxx invoice”)

Thanks, Roope

1 Like

Make sure that the type argument of the for each loop is with System.Net.Mail.MailMessages

And your condition is perfect
—make sure once that if onlyunreadmessage property is enabled then we need to have atleast once mail unread in our inbox
—and also kindly check once whether the folder property is mentioned with right folder like “Inbox” or if any subfolder be like “Inbox/Subfoldername”

You were almost done
Hope this would help you
Kindly try this and let know for any queries or clarification
Cheers @roope

@roope you are using outlook property right ?

If yes, you can directly use a filter while getting emails to cut short the time taken and fetching emails

You can use the Filter property like in save attachments if you wan to download only excel files just put “.xlsx” in filter property.