cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pramod10
Frequent Visitor

.

.

16 REPLIES 16
Rhiassuring
Super User
Super User

Hi there,

 

Yes, I think this is possible. Here is what I'd recommend after you have all of your responses in your SharePoint List:

Step 1) Get Items (no filter.)

 

Step 2)  Initialize variables: 

- strEmails (empty),

- intIndex (value: 0),

- intPeopleCount (value expression: sub(length(outputs('Get_items')?['body/value']),1) ),

- intCompleteGroups (value expression: div(variables('intPeopleCount'),4) )

- intPeopleIndex (value: 0)

 

Step 3) Do Until: 

- intGroupIndex equals intCompleteGroups

 

Step 4) Inside the Do Until:

IncrementVariable - increase intGroupIndex by 1

Step 5) Add another Do Until: 

- intPeopleCount equals 4

 

Step 6) Inside the second Do Until:

IncrementVariable - increase intPeopleCount by 1

 

Step 7) Append to String Variable: strEmails, use expression:

outputs('Get_items')?['body']?['value'][variables('intPeopleCount')]?['Author']?['Email']

(I'm using the Author field, you can use whatever your people field is.) 
Add a ";" after the expression.

 

Step 😎 Decrease intPeopleCount by 1.

 

Step 9) Outside of the second Do Until, create an email. (I'm using a Compose in place of an email so I don't spam myself, since I'm the only person in my tenant haha.) In the "To" field, place the strEmails variable. In the body of your email, where you want to callout that one individual in the group, use another expression: outputs('Get_items')?['body']?['value'][variables('intPeopleCount')]?['Author']?['DisplayName']


Step 10) Set intPeopleIndex back to 0, set strEmails to empty (just put a space in there.) 

 

💡Intermission 💡

 

And all that will produce however many groups of complete sets of 4 that there are.

Now, for the remainder....

 

Step 11) New "Do Until"..

- intPersonCount equals -1

 

Step 12) Append to string variable. strEmails - same as before, but with a hardcoded 0 this time: outputs('Get_items')?['body']?['value'][0]?['Author']?['Email'] with a semi colon after the expression.

 

Step 13) Decrement variable - intPeopleCount by 1,

Step 14) Finally, outside of that Do Until, your last email. (Mine is a Compose again instead of an email.)

 

====

 

🖥Screenshots 🖥


Overview: 

Rhiassuring_0-1660092263002.png

 

Group & People Do Untils:

Rhiassuring_1-1660092304753.png


Final Do Until & "Email":

 

Rhiassuring_2-1660092317622.png

 

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



Rhiassuring
Super User
Super User

I also feel like @ScottShearer or @VictorIvanidze or @tom_riha will have a sleeker way to do this .... I couldn't find a "give me the last 4 x in an array" anywhere, so I want to reach out to them....  

I got it to work but you shouldn't have to go through all that work if there is a more efficient way...

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



pramod10
Frequent Visitor

@Rhiassuring  Hey, thank you so much for your solution. However, I would like to point out that some of the steps names you wrote is different from the screenshots you shared. For example, "intIndex", there is no mention of it in the SS. Please let me know which are the correct ones.

Anyways, I followed your steps from the Screenshots, the flow failed in the last step where emails are supposed to be sent to the leftovers of 3 group people. Everything worked fine for the 4 group people but last step gave me an error. I am sharing the ss of the error. 

 

Please let me know how i should solve this error.

 

Thank you again for your efforts. I really appreciate them.

pramod10_0-1660124865645.png

 

pramod10
Frequent Visitor

@Rhiassuring  did the flow was working for you till the last steps?

@Rhiassuring  Can you share the ss of your flows in more detailed way( each step and maybe their expressions)  just to make sure I got everything right?

 

Thank you again.

@Rhiassuring HI, so I managed to correct the mistake and flow ran for me successfully. However, the last email group didn't have 3 people group. Just had one person.

 

Let me explain, what I wanted to achieve. Suppose I have total 13 responses(with their email) in my sharepoint list. Now, according to the current flow, it will send 4 emails in total. The first three emails will have 4 people group but the 4th email will have only one person which I am afraid I dont want. I want my flow to work in a way, like for example right now, there is only one person left so I want the flow to take one person from two 4 people group to make a 3 people group in the end. If there are 2 people left then flow should take one person from one 4 people group to make a 3 people group. If there are 3 people left, then send them emails as it is. So, ultimately, I want to have atleast 3 people group if 4 group people is not possible. 

I hope I made my point clear.

If you know how to achieve this task, please help me.

 

Thank you again.

sorry for bothering you again, however, the flow worked when I put only my email in the whole list. But i ran flow with different emails and this time the flow ran but the first four people got the same emails and rest of them didnt get any emails. so it repeated the first iteration and didnt move to the next one. 

Rhiassuring
Super User
Super User

Here are detailed screenshots of each step (and you're right, I changed the name of intIndex to intGroupIndex and forgot to update.)

Rhiassuring_0-1660152800307.png

 

 

Rhiassuring_1-1660152839413.png

 

Rhiassuring_2-1660152862899.png

Rhiassuring_3-1660152894194.png

Rhiassuring_4-1660152933567.png

Rhiassuring_5-1660152953778.png

 

Rhiassuring_6-1660152975057.png

===

 

Yes, my flow worked all the way through when I tested it. The error you've run into is in the last item - note that it is a hardcoded 0, not a variable in the last item. (Per the details of Step 12.) 

 

Question: How many people were in your list when you ran it? If you had 9 people in your list, then as of right now, 1 person would get an email on their own because you have 2 groups of 4, and 1 leftover.

I've run mine with 21 people, I have 5 groups of 4, and 1 person leftover (so one email.)

I'm reducing my list to 19 to see what I get...

So with 19 people, I get 4 groups of 4 people, and 1 group of 3 people.

Are you hoping that it will just stop if there isn't another full group of 4?

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



pramod10
Frequent Visitor

So, my expectation is if there are only 9 responses recorded in the list then, as per the flow we make two 4 people group but one is left. I dont want anyone to be left alone in the group. I need atleast 3 people group. As in this case, we have 9 responses , so the flow should check it will impossible to make a 4 people group without leaving the last one. so the flow should make group of 3 people now because we have only 9 responses however if we have 13 responses, then the flow can make one 4 people group, three 3 people group. And if we have 2 people left in the group then the flow should take one person of any 4 people group and make a last 3 people group. If I am making these groups for the sole purpose of having meetings and with one person in the group, the term meeting is useless, it doesnt make sense. I hope you get my point and if you know how to deal with this scenario, please let me know. Thank you.

Rhiassuring
Super User
Super User

I do get the point, thank you for your explanation. 

In that case, all you need do is the following: 

 

Before you move into the final Do Until, identify the amount of leftover people. Add a condition that says if intPeopleCount is equal to 2 (the values start at 0 so 2 really means 3 people) then you want to do the final Do Until & Email - if it isn't then, you want to email yourself or someone else. 

 

So it is just a condition, with your Do Until on the "Yes" side, and your "not enough people" actions on the "No" side.

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



pramod10
Frequent Visitor

Sorry I dont quite get the idea. I apologize but I am really new to PowerAutomate. Could you please show me how it is done? thank you and my sincere apologies for all the trouble.

pramod10
Frequent Visitor

@Rhiassuring I copied the entire tiles and did exactly as you did but there is a problem with the output, the flow only taking the first 4 people and running the iteration for them only, it is sending emails to the whole list, just the first four, do you know how I can fix that problem?

Rhiassuring
Super User
Super User

It is very difficult to know what the issue is when it is a complicated flow and I don't know what you have input. Are you able to show screenshots of how you have configured it, so I can ensure it matches the above? A single missing character could be the difference. Or placing things into the wrong Do Until. I can confirm from my tests that the following happened: 

- Every group of 4 that was created received an email (to all 4 users in the group, for all 5 groups individually) with one person noted as Lead. (Keep in mind that in my screenshots, I use "Compose" as a fake email since I don't want to spam myself.) 

- The left-over people receive an email with the final person. 

As for the Condition for the "less than 3 people" -- the variable called intPeopleCount counts down until there are 0 people, right? So at the end of all the groups of 4, that number will tell us how many people are remaining. Since arrays start at 0, though, consider it +1. 

So all  you need to do is create a Condition. Is intPeopleCount equal to 2? If it is, use the "Yes" path, and add the final "Do Until". If it is NOT equal to 2, then go down the "No" path. You could send yourself an email, or just end the flow. 



 

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



pramod10
Frequent Visitor

 Here are the screenshots of my flow, I am also writing the expression value in the box for your reference.

pramod10_0-1660295092929.png

pramod10_2-1660295258514.pngpramod10_3-1660295300732.png

 

pramod10_4-1660295369835.pngpramod10_5-1660295412767.png

pramod10_6-1660295439113.pngpramod10_7-1660295491813.pngpramod10_8-1660295525580.png

 

pramod10
Frequent Visitor

Here is the ss of my SP list Screenshot 2022-08-12 111901.png

Rhiassuring
Super User
Super User

Ah - I forgot we had a sub() on our intPeopleCount, so, the final condition should be equal to 3, instead of 2. My mistake on that one.

"first 4 people and running the iteration for them only, it is sending emails to the whole list, just the first four, do you know how I can fix that problem?"

 

For only the first 4 people? Can I see your Get Items configuration and an example of your Groups Do Until output?

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



Helpful resources

Announcements

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Users online (6,877)