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 / Trigger Flow only for ...
Power Automate
Unanswered

Trigger Flow only for first message in the conversation, not for replies

(0) ShareShare
ReportReport
Posted on by

I want to trigger flows for new email and create items in sharepoint. I should do this only for the first message in the conversation. No action needed for replies. 

What is the best way to fail flows for reply emails?

Condition to check reply("RE:") in email subject is one option I know. Any suggestions on a better approach.

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

    Hi @Anonymous,

     

    I am afraid that it may be the most effective way to solve your needs by checking whether the subject of the email starts with "Re:".

    Flow does not have such a trigger to recognize whether the message is the first message in the conversation currently.

    If you want to feature that you mentioned to be supported in Microsoft Flow, please submit an idea to Flow Ideas Forum:

    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

     

    Best Regards,

    Barry

  • GabrielStJohn Profile Picture
    on at

    Hello, @Anonymous!

    Thank you for posting on the Flow Community Forum! If you have already posted your idea to the Flow Community Ideas Forum or found an existing idea to upvote, then you need to post the URL to the idea’s thread as a reply to this thread. Then click "Accept as Solution" on the reply if you approve it as a solution to your issue so that other users may vote for the Flow Idea and identify the information easily within this thread.

    Thank You for being an active member of the Flow Community!

    -Gabriel
    Flow Community Manager

  • takolota1 Profile Picture
    4,974 Moderator on at

    Anyone looking for a solution to this that can't easily be messed up by users, try a trigger condition formula like...

     

     

     

    @not(and(and(contains(triggerOutputs()?['body/bodyPreview'], 'Subject:'), contains(triggerOutputs()?['body/bodyPreview'], 'Sent:')), contains(triggerOutputs()?['body/bodyPreview'], 'From:')))

     

     

     


    (Edited to include the correct trigger condition formula)

  • VictorIvanidze Profile Picture
    13,073 on at

    Hi @takolota,

    are you sure your suggestion is correct?

    I use "When a new email arrives in a shared mailbox (V2)" trigger and bodyPreview exists for the first message in the conversation. Why do you think that some messages have bodyPreview and other haven't?

  • takolota1 Profile Picture
    4,974 Moderator on at

    @VictorIvanidze 

     

    When I tested it, there were not any body preview values in the 1st message. But once the message was a reply, it included the body preview of the 1st message, thus it was no longer empty.

     

    I believe this field holds the values of previous email message bodies in the thread. You know, the dropdown/extension where you can view all the previous messages in a new message item?

  • VictorIvanidze Profile Picture
    13,073 on at

    My experience is opposite, sorry. And don't be offended, but your assumption looks really strange.  The preview is just the preview of the body of this message. The very first message has something in its body, and preview reflects the body.

    Test yourself please.

  • takolota1 Profile Picture
    4,974 Moderator on at

    @VictorIvanidze 

    You're right, I made a mistake in the 1st test that allowed the 1st message to still trigger.

    But I noticed the general idea still works because the 1st message body & preview body do not contain the previous message information or anything referencing a Subject or previous senders. So the following trigger condition does work as expected:

     

     

    @not(and(and(contains(triggerOutputs()?['body/bodyPreview'], 'Subject:'), contains(triggerOutputs()?['body/bodyPreview'], 'Sent:')), contains(triggerOutputs()?['body/bodyPreview'], 'From:')))

     

     


    I'll update previous posts to reflect this.

    Thanks,

  • VictorIvanidze Profile Picture
    13,073 on at

    It will work but quite unreliable. What if your correspondent has edit the message and remove "Subject:"?

    What if the "Subject" will be in a foreign language?

    I believe the proper way is checking if "In-Reply-To:" headers exists in the SMTP headers of the message.

  • takolota1 Profile Picture
    4,974 Moderator on at

    @VictorIvanidze 

     

    I think it’s more likely a person will change the reply subject line than go to the bottom of their email, click the dots to expand previous messages, then remove all the previous messages.

     

    Multiple languages is a good point, so I’m using both trigger conditions for my case.

    Someone would really have to be trying to get around things if they both removed the RE / FW from the subject line and all the previous message history.


    There may be a way around the multiple languages bit though. The message history also includes a From: Name <Email> line. So checking for something like concat(‘<‘, from email, ‘> linebreak-characters’) may work for different languages.

     

    @not(contains(triggerOutputs()?['body/bodyPreview'], concat('<', triggerOutputs()?['body/from'], '>')))


    This could also add an interesting difference in functionality where if someone was later added to a thread in a reply message or forward message, then the flow could also trigger the first time they respond in the thread.
    So this could be set where the 1st email receives an automatic reply message, then anyone new who responds to the thread also receives the automatic reply message on their 1st response.

     

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 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard