Hello,
I have a flow that works for the most part, however it seems that the primary condition in my flow (email subject contains) is case sensitive...
I'm trying to write a condition that if the email subject contains the words "new employee" that a flow is triggered. However it seems that the contains option doesn't have as case insensitive option. For example "new employee" or "New Employee" or "NEW EMPLOYEE" should all trigger the same flow.
Is there an option that can be triggered regardless of case ?
Solved! Go to Solution.
Hi @ OC-ITServices,
I have try the expression below in the Condition:
@contains(toUpper(triggerBody()?['Subject']), 'NEW EMPLOYEE')
And the flow as below:
And when I send the email with subject as "new EMPLOYEE", the flow would run successfuly as below:
I afraid there is something wrong on the expression "contains(triggerBody()?['To'], 'person1@someplace.com;person2@someplace.com')" in your Condition.
Do you want to check if the email is sent to "person1@someplace.com" or "person2@someplace.com"?
Or do you want to check if the email is sent to "person1@someplace.com" and "person2@someplace.com"?
If you want to check if the email is sent to "person1@someplace.com" or "person2@someplace.com",please enter the expression below in the Condition:
@and(contains(toUpper(triggerBody()?['Subject']), 'NEW EMPLOYEE'),or(contains(toLower(triggerBody()?['To']), 'person1@someplace.com'),contains(toLower(triggerBody()?['To']), 'person2@someplace.com')))
If you want to check if the email is sent to "person1@someplace.com" and "person2@someplace.com",please enter the expression below in the Condition:
@and(contains(toUpper(triggerBody()?['Subject']), 'NEW EMPLOYEE'),or(contains(toLower(triggerBody()?['To']), 'person1@someplace.com;person2@someplace.com'),contains(toLower(triggerBody()?['To']), 'person2@someplace.com;person1@someplace.com')))
Please let me know if your problem could be solved.
Regards,
Alice Zhang
Have you tried converting the subject line to a single case using either the toUpper() or toLower() expressions and then comparing against a single case string?
If you need additional help - please post here.
If this solves your issue, please mark your issue as Solved.
Good luck!
Scott
Would the condition be something like this:
@and(contains(toUpper(triggerBody()?['Subject']), 'NEW EMPLOYEE'),contains(triggerBody()?['To'], 'person1@someplace.com;person2@someplace.com'))
I've tried this, but it seems to fail.
Please provide the specifics of what you are trying to accomplish and I will try to assist.
Scott
Hi @ OC-ITServices,
I have try the expression below in the Condition:
@contains(toUpper(triggerBody()?['Subject']), 'NEW EMPLOYEE')
And the flow as below:
And when I send the email with subject as "new EMPLOYEE", the flow would run successfuly as below:
I afraid there is something wrong on the expression "contains(triggerBody()?['To'], 'person1@someplace.com;person2@someplace.com')" in your Condition.
Do you want to check if the email is sent to "person1@someplace.com" or "person2@someplace.com"?
Or do you want to check if the email is sent to "person1@someplace.com" and "person2@someplace.com"?
If you want to check if the email is sent to "person1@someplace.com" or "person2@someplace.com",please enter the expression below in the Condition:
@and(contains(toUpper(triggerBody()?['Subject']), 'NEW EMPLOYEE'),or(contains(toLower(triggerBody()?['To']), 'person1@someplace.com'),contains(toLower(triggerBody()?['To']), 'person2@someplace.com')))
If you want to check if the email is sent to "person1@someplace.com" and "person2@someplace.com",please enter the expression below in the Condition:
@and(contains(toUpper(triggerBody()?['Subject']), 'NEW EMPLOYEE'),or(contains(toLower(triggerBody()?['To']), 'person1@someplace.com;person2@someplace.com'),contains(toLower(triggerBody()?['To']), 'person2@someplace.com;person1@someplace.com')))
Please let me know if your problem could be solved.
Regards,
Alice Zhang
How could you apply this case insensitive condition to attachment file extensions? I am having a problem where attachments that are ".PDF" as opposed to ".pdf" do not get included in the flow. The flow checks for emails in a specific folder in outlook for pdf attachments and saves them into a SharePoint folder. I just don't know enough about the language to know where to put the toUpper function. Thanks.
Should be something like (I have not tested this yet):
@contains(items('Apply_to_each_Attachment_on_the_email')?['NAME'],toLower(triggerBody()?['.pdf'])
Thanks @OC-ITServices, unfortunately when I tried your suggestion I received the following error when attempting to save the flow:
The template validation failed: 'The template action 'Condition_2' at line '1' and column '2812' is not valid: "Unable to parse template language expression 'contains(items('Apply_to_each_Attachment_on_the_email')?['NAME'],toLower(triggerBody()?['.pdf'])': expected token 'RightParenthesis' and actual 'EndOfData'.".'.
Sorry about that. Unfortunately I don't have time at the moment to test/troubleshoot this. I'd recommend you start a new thread for your issue, and you might get faster answer (since this thread was already marked as solved.
Try using "OR" by using function "Add row" in the Condition as mentioned in below screenshot.
This worked in my case:
The straight way to solve this should be set this condition (note: $myField is the variable that contains the string you want to match):
toUpper($myField) contains SOMETHING
But if I use toUpper() then I can't select $myField, I only can see some variables but not all.
This is how I managed it: I created a compose action and I set the input to $myField and then I used the @toUpper(outputs('Compose')) in the contains expression.
This worked. Now I can match the object of an email in a case insensitive manner and the condition is true if it contains Ferie, FERiE, ferie or permesso, PERMESSO, pErmEssO.
(PowerAutomate in Italian language)
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Did you know that you could restore a deleted flow? Check out this helpful article.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
28 | |
28 | |
26 | |
25 | |
22 |
User | Count |
---|---|
64 | |
52 | |
44 | |
34 | |
30 |