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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Using "startswith" Condition from Email Body

(0) ShareShare
ReportReport
Posted on by 44

Hi everyone!

 

I was having a little trouble using thee "starts with" condition in my flow. Here's some of my previous posts as to what I am building. This should probably be super easy for you guys.

 

One of my conditions to update certain columns I was wanting it to be if the email starts with certain text. Whenever I use the "startswith" function, even though I started the email with the specific words, it always comes back as false. I tried doing it is a function startswith(variable('BodyString'),'MarkAsNew') and on the equals put true (from the function tab) as well and that did not work. 

 

What am I doing wrong?

 

Example test email I sent myself:

image.png

Here's the flow's guts:
image.png

 Closer look at the condition:

image.png

 

 

 

Thank you kindly,

 

KL

 

 

I have the same question (0)
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at
    Re: Using "startswith" Condition from Email Body

    @SupplyChainKL 

     

    Use compose action and supply input of your email body then run flow and see output of compose action. Is it really started with this text?

     

    Thanks

    Hardesh

  • Verified answer
    abm abm Profile Picture
    32,600 Most Valuable Professional on at
    Re: Using "startswith" Condition from Email Body

    Hi @SupplyChainKL 

     

    You didn't mention about what error you are getting here? Could you please expand the IF condition and see what error flow is returning. You might be receiving the email as html format. So in that case you need to convert to HTML to text and compare. Here is the test I did and it is working as expected.

     

    image.png

     

    Here is my test result

     

    image.png

     

    Please try the above and let me know the results.

     

    Thanks

  • SupplyChainKL Profile Picture
    44 on at
    Re: Using "startswith" Condition from Email Body

    Hi @abm 

     

    That worked! I added in the step that you had to convert the html into plain text. 

     

    So this might be a stupid question but what is the difference between something being formatted as an HTML and plain text? I am really enjoying learning all of this stuff and I am taking baby steps!

     

     

     

    Thank you,

     

    KL

  • SupplyChainKL Profile Picture
    44 on at
    Re: Using "startswith" Condition from Email Body

    Hi @Hardesh15 !

     

    Thank you for your help! I think it was the HTML thing mentioned by user abm. Or at least, that seemed to work. I can't remember what the error was to test your theory. Sorry! 

     

     

     

    Best,

     

    KL

  • abm abm Profile Picture
    32,600 Most Valuable Professional on at
    Re: Using "startswith" Condition from Email Body

    Hi @SupplyChainKL 

     

    Glad to hear that it is working as expected. So client can receive email as HTML or plain. Looks like your email client default config is HTML emails. So if you add a compose and map the body you can see it returns the email body contains the HTML tags. So to clean up I suggested to use the HTML to text. Hope it make sense.

     

    If your problem has solved, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

     

    Thanks

  • SupplyChainKL Profile Picture
    44 on at
    Re: Using "startswith" Condition from Email Body

    So basically, the HTML text formatting is a different format than the flow is comparing against? So then it was returning as always not matching (false) even though it was supposed to be true?

  • abm abm Profile Picture
    32,600 Most Valuable Professional on at
    Re: Using "startswith" Condition from Email Body

    Hi @SupplyChainKL 

     

    So when flow compares the body and if the email is an html format the beginning tag starts with <html> hence your condition will be always false. As I mentioned earlier add a compose and map the body of the flow. Run the flow. Check the run history and the compose step. You can see the actual HTML body.

  • SupplyChainKL Profile Picture
    44 on at
    Re: Using "startswith" Condition from Email Body

    That makes sense! 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard