I realize that there are many threads on this but each with a little variation. My flow is working perfect for how I designed it and I love the table design it produces. The project has grown so we need to modify the daily email. How do I now adjust this for the assigned owner of the task (from a sharepoint list) to just receive their tasks.
I just have outputs in the body of the email and it is addressed to the whole team. Thank you.
Hi @lbm24 ,
Here is a quick example about how to identify the unique values for the users in your SharePoint List, and generate a single table and email for each of them.
If any of the steps below are not clear or do not match exactly to your use case, please do not hesitate in asking for more instructions or bringing more context about your needs.
Documentation and reference links
Before start it, I'm sharing some useful links related to the topics discussed in this solution. It may be helpful for you or for any other users that find this thread and don't necessarily are comfortable with some Power Automate concepts:
Overview of the list
I will generate an individual HTML table per Sales person, which will contain only their own records. The Sales person column is of "Person" type, but you can replicate this logic for other data types too.
Step 1 - Starting the flow
I'm starting the flow by returning the records from my List and, right after that, initializing an array variable that I've called "unique_users":
This array variable will store the email address of the 'Sales person', and it will be useful to filter our 'Get items' by user in a future action.
Step 2 - Get unique 'Sales person'
Now we need to loop the List a first time, just to capture the unique values from 'Sales person' column. To achieve it, insert an 'Apply to each' action, passing the 'body/value' from the 'Get items' as input. Inside the loop, add a condition to test if the array 'unique_users' contains the record's sales person email and allocate an 'Append to array variable' action into the 'If no' block:
Notes about condition:
In this step, we are accessing each item of the 'Get items' output and checking if we've already stored the 'Sales person' email in the 'unique_users' variable (the condition expression performs this task). If we didn't, the 'If no' block will be executed and we will insert the email address into the array. In this step, make sure to use the person's email, or any other unique identifier of string data type to control the unique users, as the contains expression can be used only with strings.
Step 3 - Getting records by each user
After your 'Apply to each', add another one, but at this time passing the 'unique_users' array as input. Inside this second loop, allocate a 'Filter array' action, which will receive the body/value from 'Get items' action as input. In the 'Filter Query', allocate the 'Sales person email' (in your case, the person column email) dynamic content into the left side input, keep the dropdown as 'is equal to' and insert the dynamic content related to the 'current item' of the current 'Apply to each' loop into the right side input.
Note: When selecting the 'Current item' dynamic content, make sure to choose the correct 'Apply to each', as you have two loops in your flow.
In this step, we are reading again the 'Get items' action output and filtering it only by the records related to a specific Sales person.
Step 4 - Generating the HTML table
From now on, you can follow the same design that you already have, just allocating it inside this second loop. Generate your HTML table based on the 'Filter array' instead of the 'Get items', and send it to the desired user.
Testing the flow
The flow ran successfully:
For each of the 'Sales person' users, we have an individual HTML table:
Let me know if it works for you or if you need any additional help!
-------------------------------------------------------------------------
If this is the answer for your question, please mark the post as Solved.
If this answer helps you in any way, please give it a like.
http://digitalmill.net/
https://www.linkedin.com/in/raphael-haus-zaneti/
Hopefully this is a bit simple, ... try these steps:
Use the value from the Get items as the 'From' field, then tap the little pen on the right and delete everything in the 'Map' field then just select the Owners Email (Assignee's?) value as the only thing in there.
Once you have that you can run an 'Apply to each' action afterwards using this expression in the '*Select an output from previous steps' field at the top of it:
union(
body('SelectOwners'),
body('SelectOwners')
)
This assumes you have named the Select action 'SelectOwners' as I did.
Anyway, what that does is combine that array of emails with itself, and in doing so it removes any duplicates. This way you have a definable list of everyone with tasks in the SharePoint list.
Here's what that might look like in brief:
Now within the Apply to each action (I named mine 'ForEachOwner' as above) you make your first action in there a Filter action. This filters on the 'Get items' SharePoint value as the source, and with the Assignee Email (Owner Email) as the condition matching the current ForEachOwner value.
Filter Details:
Key | Value | ||||||
From |
|
||||||
Where |
Condition
|
{"id":"b2937071-19a8-4991-8048-55b3d1f255e6","brandColor":"#8C3900","connectionReferences":{"shared_sharepointonline_1":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/shared-sharepointonl-70a14524-6d74-4196-b1fc-31d350117f82"}},"shared_office365groups_1":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365groups/connections/shared-office365grou-180a283c-7004-4e98-af2b-62add6851f27"}},"shared_office365users":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365users/connections/shared-office365user-1c9e8d17-f826-49eb-979d-0e77-6351db2d"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Scope_SendToEachOwner","operationDefinition":{"type":"Scope","actions":{"SelectOwners":{"type":"Select","inputs":{"from":"@outputs('Get_items')?['body/value']","select":"@item()?['Assignee/Email']"},"runAfter":{},"metadata":{"operationMetadataId":"e5c9e8b6-dccb-4875-b46d-33b3f8c0eb9a"}},"ForEachOwner":{"type":"Foreach","foreach":"@union(\r\n body('SelectOwners'),\r\n body('SelectOwners')\r\n)","actions":{"FilterToCurrentEmail":{"type":"Query","inputs":{"from":"@outputs('Get_items')?['body/value']","where":"@equals(item()?['Assignee/Email'], items('ForEachOwner'))"},"runAfter":{},"metadata":{"operationMetadataId":"adcc62ff-bf76-4e3c-a7ca-b62cda64eb1b"}},"Scope_Use_Compose_Actions_For_Data":{"type":"Scope","actions":{"EmailCurrentOwner":{"type":"Compose","inputs":"@items('ForEachOwner')","runAfter":{},"metadata":{"operationMetadataId":"032dbeeb-a7c8-4fa3-beff-9cbabb0ffa0a"}},"ProjectName":{"type":"Compose","inputs":"@body('FilterToCurrentEmail')[0]?['ProjName']","runAfter":{"EmailCurrentOwner":["Succeeded"]}},"Description":{"type":"Compose","inputs":"@body('FilterToCurrentEmail')[0]?['Description']","runAfter":{"EmailCurrentOwner":["Succeeded"]}},"DisplayNameCurrentOwner":{"type":"Compose","inputs":"@body('FilterToCurrentEmail')[0]?['Assignee/DisplayName']","runAfter":{"EmailCurrentOwner":["Succeeded"]},"metadata":{"operationMetadataId":"6144e0a0-4223-409a-b39f-525b73a51ada"}},"Task":{"type":"Compose","inputs":"@body('FilterToCurrentEmail')[0]?['Title']","runAfter":{"EmailCurrentOwner":["Succeeded"]}},"EmailBodyComposeConstants":{"type":"Compose","inputs":"<p>Hi, @{outputs('DisplayNameCurrentOwner')}</p>\n<p> </p>\n<h1>@{outputs('ProjectName')}</h1>\n<p>For this project the below task is currently owned by yourself and needing action.</p>\n<p> </p>\n<blockquote>\n <h2>@{outputs('Task')}</h2>\n <p>@{outputs('Description')}</p>\n</blockquote>\n<p> </p>\n<p>Let us all know how you progress by updating the <a href=\"@{outputs('LinkToListItem')}\" target=\"_blank\">item in the list</a> once done!</p>\n<p> </p>\n<p>Best<br/>\nTask Notifier Bot</p>","runAfter":{"EmailSubjectComposeConstants":["Succeeded"]},"metadata":{"operationMetadataId":"ffeb3084-2669-4f32-8e1c-3ee66aa3aa21"}},"EmailSubjectComposeConstants":{"type":"Compose","inputs":"@{outputs('ProjectName')} - Action Required - @{outputs('Task')}","runAfter":{"LinkToListItem":["Succeeded"]}},"LinkToListItem":{"type":"Compose","inputs":"@body('FilterToCurrentEmail')[0]?['{Link}']","runAfter":{"ProjectName":["Succeeded"],"Task":["Succeeded"],"Description":["Succeeded"],"DisplayNameCurrentOwner":["Succeeded"]}}},"runAfter":{"StylesForEmail":["Succeeded"]},"description":"The actions in this scope assume that there is only one task - Please look at the Select and HTML scopes for multiple task interpretations of the data"},"Scope_Use_Select_Action_To_Send_Sculpted_Emails_Per_Task":{"type":"Scope","actions":{"ForEachTaskAnEmail":{"type":"Foreach","foreach":"@body('SelectDetails')","actions":{"EmailBodyComposeSelectItem":{"type":"Compose","inputs":"<p>Hi, @{outputs('SingleObjectData')?['OwnerDisplayName']}</p>\n<p> </p>\n<h1>@{outputs('SingleObjectData')?['ProjectName']}</h1>\n<p>For this project the below task is currently owned by yourself and needing action.</p>\n<p> </p>\n<blockquote>\n <h2>@{outputs('SingleObjectData')?['Task']}</h2>\n <p>@{outputs('SingleObjectData')?['Description']}</p>\n</blockquote>\n<p> </p>\n<p>Let us all know how you progress by updating the <a href=\"@{outputs('SingleObjectData')?['TaskLink']}\" target=\"_blank\">item in the list</a> once done!</p>\n<p> </p>\n<p>Best<br/>\nTask Notifier Bot</p>","runAfter":{"EmailSubjectSingleTask":["Succeeded"]},"metadata":{"operationMetadataId":"ffeb3084-2669-4f32-8e1c-3ee66aa3aa21"}},"EmailSubjectSingleTask":{"type":"Compose","inputs":"@{outputs('SingleObjectData')?['ProjectName']} - Action Required - @{outputs('SingleObjectData')?['Task']}","runAfter":{"SingleObjectData":["Succeeded"]}},"SingleObjectData":{"type":"Compose","inputs":"@items('ForEachTaskAnEmail')","runAfter":{}}},"runAfter":{}}},"runAfter":{"StylesForEmail":["Succeeded"]},"description":"This will send an email per task or if you would like mould it into something a bit more flowing instead of a table"},"Scope_Use_HTML_Table_To_Represent_Data":{"type":"Scope","actions":{"Create_HTML_table":{"type":"Table","inputs":{"from":"@body('FilterToCurrentEmail')","format":"HTML","columns":[{"header":"Project Name","value":"@item()?['ProjName']"},{"header":"Task","value":"@item()?['Title']"},{"header":"Description","value":"@item()?['Description']"},{"header":"Owner","value":"@item()?['Assignee/DisplayName']"}]},"runAfter":{}},"EmailBodyHtmlTable":{"type":"Compose","inputs":"<p>Hi, @{body('SelectDetails')[0]?['OwnerDisplayName']}</p>\n<p> </p>\n<p>Below is the current collection of tasks that are pending you for their given projects.</p>\n<p> </p>\n@{body('Create_HTML_table')}\n<p> </p>\n<p>Best<br/>\nTask Notifier Bot</p>","runAfter":{"Create_HTML_table":["Succeeded"]}}},"runAfter":{"StylesForEmail":["Succeeded"]}},"StylesForEmail":{"type":"Compose","inputs":"<STYLE>\n</STYLE>","runAfter":{"TaskCount":["Succeeded"]}},"TaskCount":{"type":"Compose","inputs":{"TotalTasks":"@length(body('FilterToCurrentEmail'))"},"runAfter":{"SelectDetails":["Succeeded"]}},"SelectDetails":{"type":"Select","inputs":{"from":"@body('FilterToCurrentEmail')","select":{"OwnerDisplayName":"@item()?['Assignee/DisplayName']","OwnerEmail":"@item()?['Assignee/Email']","Description":"@item()?['Description']","ProjectName":"@item()?['ProjName']","Task":"@item()?['Title']","TaskLink":"@item()?['{Link}']"}},"runAfter":{"FilterToCurrentEmail":["Succeeded"]},"description":"Using a Select here can simplify your options later"},"Scope_Use_Select_To_Sculpt_Data_Into_Graceful_HTML":{"type":"Scope","actions":{"SelectHTMLInsert":{"type":"Select","inputs":{"from":"@body('SelectDetails')","select":"@concat(\r\n '\\n<p> </p>\\n<h2>\\n\\t',\r\n outputs('SingleObjectData')?['ProjectName'],\r\n ' - ',\r\n outputs('SingleObjectData')?['Task'],\r\n '</h2>\\n',\r\n '<p>\\n\\t',\r\n outputs('SingleObjectData')?['Description'],\r\n '</p>\\n<p> </p>\\n'\r\n)"},"runAfter":{},"description":"Using a Select here can simplify your options later"},"SelectSculptedGracefulEmailBody":{"type":"Compose","inputs":"<p>Hi, @{body('SelectDetails')[0]?['OwnerDisplayName']}</p>\n<p> </p>\n<p>Below is the current collection of tasks that are pending you for their given projects.</p>\n<p> </p>\n@{join(\r\n body('SelectHTMLInsert'),\r\n outputs('carriageCNST')\r\n)}\n<p> </p>\n<p>Best<br/>\nTask Notifier Bot</p>","runAfter":{"SelectHTMLInsert":["Succeeded"]},"description":"This gets the display name from the first SelectDetails item - body('SelectDetails')[0]?['OwnerDisplayName'] ------ This joins SelectHTMLInsert items together with a carriage return - join(body('SelectHTMLInsert'), outputs('carriageCNST'))"}},"runAfter":{"StylesForEmail":["Succeeded"]}},"Scope_Sorted_By_Project":{"type":"Scope","actions":{"SelectProjects":{"type":"Select","inputs":{"from":"@body('FilterToCurrentEmail')","select":"@item()?['ProjName']"},"runAfter":{}},"ForEachProject":{"type":"Foreach","foreach":"@union(\r\n body('SelectProjects'),\r\n body('SelectProjects')\r\n)","actions":{"How_to_make_this_work":{"type":"Compose","inputs":"I have not done the work, here, from a time perspective, but for each project you could filter the SelectDetails by the project name, then use any of the other methods (or some combined) to combine into an array, then join that array to make new HTML body!","runAfter":{}}},"runAfter":{"SelectProjects":["Succeeded"]}}},"runAfter":{"StylesForEmail":["Succeeded"]}}},"runAfter":{"carriageCNST":["Succeeded"]},"metadata":{"operationMetadataId":"f1500274-e446-40ed-9d63-73851b764ab4"}},"carriageCNST":{"type":"Compose","inputs":"\n","runAfter":{"SelectOwners":["Succeeded"]}}},"runAfter":{"Get_items":["Succeeded"]},"metadata":{"operationMetadataId":"e0535eea-c6db-46c6-9398-2e9cd3acbc66"}}}
Compose Name | Expression |
EmailCurrentOwner |
|
DisplayNameCurrentOwner |
|
The EmailCurrentOwner expression is relatively simple; it literally takes the value of the email that this particular loop of the ForEachOwner is concerned with. You can select this very value from the Dynamic Data (lightening bolt) under 'Current item' at the bottom.
The DisplayNameCurrentOwner expression does a few things:
Everything above was done based on VERY big assumptions on the field names from what I could ascertain from your imagery above. So you may need to adjust a bit if you were to directly use any of this.
Equally, if the above is accurate you could just use those as in-place constants that can define that information for you.
Finally, be careful of using Variables inside Apply to each loops. If you do (perhaps to separate the tasks into a 'per project' way) then ensure that your Apply to each loop containing the variable has the Concurrency setting set to '1' so that it only handles one loop at a time. This stops different loops using the same value from the variable.
Ugh, I despise it when the Community post editor is being a pain like this.
I cannot edit the above without losing it, I suspect due o the fact that I have included a full scope for you to just paste into your flow.
Just CTRL+V (in Windows) when you're on the My clipboard tab of the add an action flyout and you will get some nice stuff to play with!
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24 17 @Anil_g 7 @ManishSolanki 13 @eetuRobo 5 @David_MA 10 @VishnuReddy1997 5 @SpongYe 9JhonatanOB19932 (tie) @Nived_Nambiar 8 @maltie 2 (tie) @PA-Noob 2 (tie) @LukeMcG 2 (tie) @tgut03 2 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate @Deenuji 12@ManishSolanki 19 @Anil_g 10 @NathanAlvares24 17 @VishnuReddy1997 6 @Expiscornovus 10 @Tjan 5 @Nived_Nambiar 10 @eetuRobo 3 @SudeepGhatakNZ 8 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2 Anil_g2 SharonS2
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages