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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Keyword Flagging Flow

(0) ShareShare
ReportReport
Posted on by 9
ㅑ would like to create a flow that flags emails based on specific conditions. For example, if an email contains the word “dinner,” it should be automatically flagged. I have attempted to set this up myself, as shown below, but the test is currently failing.
 
My set up is as below:
{"nodeId":"Condition","serializedValue":{"type":"If","expression":{"contains":["@triggerOutputs()?['body/body']","dinner"]},"actions":{"Flag_email":{"type":"OpenApiConnection","inputs":{"parameters":{"messageId":"@triggerOutputs()?['body/id']"},"host":{"apiId":"/providers/Microsoft.PowerApps/apis/shared_office365","connection":"shared_office365","operationId":"Flag_V2"}}}},"else":{"actions":{}},"runAfter":{}},"allConnectionData":{"Flag_email":{"connectionReference":{"api":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365"},"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365/connections/shared-office365-bc79df50-bad1-47cb-b507-b3b1d7f5b8a9"},"connectionName":"shared-office365-bc79df50-bad1-47cb-b507-b3b1d7f5b8a9"},"referenceKey":"shared_office365"}},"staticResults":{},"isScopeNode":true,"mslaNode":true}
 
Screenshot 2026-03-18 163725.png
Screenshot 2026-03-18 163710.png
error1.png
I have the same question (0)
  • Suggested answer
    PowerDeveloperTP Profile Picture
    453 on at
    Hello, 
     
    Could you please add compose with message id before flag action to see if you are getting correct email.
    Secondly, could you please ensure the trigger is V3?
     
    Alternately, you can use send an http request (office 365 outlook), and use graph api for flagging the email, as above flag email action also uses graph api at the background. Also, ensure you have provided header and content type with the api request (second screenshot), failing to do so will result in errors. Thank you.
     
     
     
     
     
    Thank you.
    Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
    This helps others find solutions to future issues!
  • Suggested answer
    Inogic Profile Picture
    1,291 Moderator on at
    Hi,
     
    The problem in flow is simple, but it happens because of how email data comes in Power Automate.
    First, the email body is not normal text. It comes in HTML format (with tags like <p>, <div>, etc.). When you try to check:
    contains(triggerOutputs()?['body/body'], 'dinner')
    you are searching inside HTML, not clean text. Because of that, sometimes the word is not matched properly.
    Second, contains() is case-sensitive. So:
    • “dinner” works
    • “Dinner” or “DINNER” will not match
    Because of these two reasons, your condition is failing.

    Correct and simple solution
    Step 1: Add an action

    HTML to Text (right after the trigger)

    Step 2: Change your condition to:
    contains(
        toLower(outputs('Html_to_text')),
        'dinner'
    )

    Why this works

    • HTML to Text → removes all HTML tags
    • toLower() → converts everything to lowercase
    • contains() → now checks properly

    Final logic

    1. When new email arrives
    2. Convert email body using HTML to Text
    3. Check condition (with toLower + contains)
    4. If true → Flag email
    In short, the issue was:
    • You were checking HTML instead of text
    • You were not handling uppercase/lowercase
    Hope this helps.
     
    Thanks!
    Inogic

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard