web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Creating task on Plann...
Power Automate
Unanswered

Creating task on Planner by specific keyword in email

(0) ShareShare
ReportReport
Posted on by 78

Hi friends,

 

I'm creating a flow where when a specific keyword is detected in an email, it will automatically creates a task in the Planner. Here's my detailed flow:

Qistina_0-1708678354159.png

Qistina_2-1708678381780.png
cont after Append to array variable function in the If yes branch:
Qistina_3-1708678405887.png

Qistina_4-1708678413559.png

 

Please ignore the "Initialize Variable - Attachments" and "Apply to Each - Attachments" as I think it's not related but I insert it as well just in case. But here's the flow again where I show only the part where I think is important, which is the condition.

Qistina_0-1708678800756.png

 



Keywords:
1. Purchase Order
2. PO

The problem is, when I tested the flow by sending an email, it creates task when the email contains the keyword and also when it doesn't contain the keyword. I only want to create task when it contains the keyword.

Please advise. Thank you very much.

Categories:
I have the same question (0)
  • v-yetonggu-msft Profile Picture
    on at

    Hi @Qistina ï¼Œ

    Please check carefully whether the subject and body of your email contain the string 'PO'.

     

    Best Regards,

    Sunshine Gu

  • Qistina Profile Picture
    78 on at

    Hi @v-yetonggu-msft ,

     

    Yes, I tested it out for both scenario. It creates a task when the email contains the keyword and also when the email does not contains the keyword. Why did that happen?

  • Verified answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @Qistina 

     

    I think i got the reason behind the issue. If i am right > You are looking to trigger the process when the email contains word like PO or Purchase Number either in body/subject of email. 

    But doing some trials on this - i got to know that mail gets trigger even when body /subject of the email have like this: 

    Nived_Nambiar_0-1708838856444.png

     

    Nived_Nambiar_1-1708838875656.png

     

     

    So if you want to trigger for mail body/subject look like this- 

    Nived_Nambiar_2-1708838948752.png

     

    In condition part you can put a space before and after keyword like PO and Purchase Number so that it looks for standalone words/sentence.

    Nived_Nambiar_3-1708839017082.png

     

    So for example- if you are writing PO - > first put space before writing PO and a space after writing PO word. In that case it would consider space before and after PO 

     

    Hope it helps !

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Qistina Profile Picture
    78 on at

    Hi @Nived_Nambiar 

     

    Thank you for your response.

     

    I figured out the problem. It is true what you said regarding this:

    Qistina_0-1708910400377.png

    because I just realized in my email signature, there's a PO in some words such as:

    Qistina_1-1708910505356.png


    So, to prevent this from happening in order to only detects "PO" or "Purchase Order" as standalone, it makes sense to put the space before and after the keyword. However, after I tested it out, now it does not detect the keywords at all and the condition is False.

    Qistina_2-1708912220966.png

     

    Qistina_3-1708912233180.png


    But if I don't put the space before and after the keyword, then it's gonna detect PO even if it's in other sentence like "imPOrtant" and proceeds to create task.

    How did you manage to make the keywords standalone? Please advise. Thank you so much

    update: it's also the same for the keyword "purchase order" if i put space before and after; condition is false

    Qistina_0-1708912751082.png
    Qistina_1-1708912761675.png

     

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @Qistina 

     

    It should work when providing spaces on both sides of PO /Purchase Number value. Not sure why it is not working for you.

     

    Another way would be to use expression like below 

     

    Nived_Nambiar_0-1708916891186.png

     

    Expression:-  contains(triggerOutputs()?['body/body'],' PO ')

     

    Nived_Nambiar_1-1708916934645.png

     

    Expression:-  contains(triggerOutputs()?['body/body'],' Purchase Order ')

     

    Nived_Nambiar_2-1708916972529.png

     

    Expression:-  contains(triggerOutputs()?['body/subject'],' PO ')

     

    Nived_Nambiar_3-1708917003534.png

     

    Expression:- 

    contains(triggerOutputs()?['body/subject'],' Purchase Order ')
     
    Try this and let me know 🙂
     
    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • Qistina Profile Picture
    78 on at

    Hi @Nived_Nambiar ,

     

    Thank you for your response.

     

    Unfortunately, using expression does not help as well. The only problem now is I can't set it to find the word/sentence as a standalone. So it's gonna be a bit of a trouble since all of our company staff's email signature has "PO" in the sentence (imPOrtant) which means it's gonna create a task for every email received then.

    I also tried creating a new flow, but the error is still the same. 

    Any tips?

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @Qistina 

     

    For me it is working fine , it is able to detect standalone PO /Purchase Order words and is able to go through yes branch -stating condition is getting satisifed.

     

    One more thing in my answer- i have used Purchase Number as keyword instead of Purchase Order keyword while writing contains expression. I have updated the expression in earlier reply , kindly check 🙂

     

     

  • Qistina Profile Picture
    78 on at

    Hi @Nived_Nambiar ,

     

    Yes, I changed the keyword to Purchase Order but it's still the same. However, after lots of try an error, what works for me is by only putting space before the keyword, after is not needed. Thank you very much for your help.

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    It is quite interesting that putting a space only before works , as  words should be seperated by atleast a space before and after 🤔.

     

    Just thinking if you convert the html body structure to plain text using below action and use that output in the condition within the body by providing spaces before and after for PO and Purchase Order , would that work ?

     

    Nived_Nambiar_0-1709565045653.png

     

     

    Give a try with this as well !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard