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:

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