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 Platform Community / Forums / Power Automate / Get List of Tasks and ...
Power Automate
Answered

Get List of Tasks and filter to match the subject from email then extract the task ID of the match

(0) ShareShare
ReportReport
Posted on by 13

Hello Community,

 

I have built a flow that monitors emails sent to a specific email address, and then checks if a task exists that matches the subject line. If not, it creates the task based on the subject line. I strip off the RE: and FW, etc, to create a "clean" subject line.

 

So the problem is, when I check for an existing task, I do this:

Screenshot 2022-12-30 at 10.07.37.png

So, I get a list of tasks, and I filter that list based on matching the subject line containing the task title.

 

What I am struggling to do is once I have a match to the subject title to extract the task ID directly into a single variable, maybe?, and then use that to update the task under the yes branch instead of running through the "apply to each" part.

 

Once I can get that sorted out, I am thinking of creating scopes to split some things. 

 

The flow works, but I am trying to streamline it and make it more efficient.

 

I didn't do this on my own. I used multiple ideas from many different members, there are so many, but these were the main ones:

 

Power Automate: How to add all email attachments to Planner? - Manuel T. Gomes

Power Automate: How to add all email attachments to Planner? - Manuel T. Gomes

https://powerusers.microsoft.com/t5/Building-Flows/Detecting-if-a-folder-exists-in-Sharepoint-Library/td-p/490655

https://powerusers.microsoft.com/t5/Building-Flows/Detect-if-folder-exists/td-p/1734916

https://powerusers.microsoft.com/t5/Using-Connectors/Checking-if-email-has-attachment/td-p/622406

 

I would appreciate any advice you can give me.

 

Regards

Marc

Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,830 Most Valuable Professional on at

    Hi @vdpollm,


    Within the If Yes section you could add a Set Variable action with an expression which retrieves the id of the task of the first match.


    Below is an example

     

    1. In the beginning of your flow add a new Initialize variable action of type string

     

    addstringvariable.png

     

    2. Within the if Yes section add a Set Variable action with the expression below:

     

     

    body('Filter_array_of_Tasks')[0]['id']

     

     

    taskid_offirstmatch.png

  • vdpollm Profile Picture
    13 on at

    Hello @Expiscornovus , thank you so very much. i am going to check it today, and will feed back to you. you are a legend.

  • vdpollm Profile Picture
    13 on at

    hello @Expiscornovus it worked. yay. that is so awesome. thank you. now, you have given me an idea for the rest of my flows where I am checking whether files and folders exist, I can follow the same principle. 

    Next steps will be to see who the task is assigned to and @mention them in a teams notification. have some ideas around that based off of a few posts. 

     

    thank you again, this really helped me.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard