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

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!   Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪 🌠  

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

March User Group Update: New Groups and Upcoming Events!

  Welcome to this month’s celebration of our Community User Groups and exciting User Group events. We’re thrilled to introduce some brand-new user groups that have recently joined our vibrant community. Plus, we’ve got a lineup of engaging events you won’t want to miss. Let’s jump right in: New User Groups   Sacramento Power Platform GroupANZ Power Platform COE User GroupPower Platform MongoliaPower Platform User Group OmanPower Platform User Group Delta StateMid Michigan Power Platform Upcoming Events  DUG4MFG - Quarterly Meetup - Microsoft Demand PlanningDate: 19 Mar 2024 | 10:30 AM to 12:30 PM Central America Standard TimeDescription: Dive into the world of manufacturing with a focus on Demand Planning. Learn from industry experts and share your insights. Dynamics User Group HoustonDate: 07 Mar 2024 | 11:00 AM to 01:00 PM Central America Standard TimeDescription: Houston, get ready for an immersive session on Dynamics 365 and the Power Platform. Connect with fellow professionals and expand your knowledge. Reading Dynamics 365 & Power Platform User Group (Q1)Date: 05 Mar 2024 | 06:00 PM to 09:00 PM GMT Standard TimeDescription: Join our virtual meetup for insightful discussions, demos, and community updates. Let’s kick off Q1 with a bang! Leaders, Create Your Events!  Leaders of existing User Groups, don’t forget to create your events within the Community platform. By doing so, you’ll enable us to share them in future posts and newsletters. Let’s spread the word and make these gatherings even more impactful! Stay tuned for more updates, inspiring stories, and collaborative opportunities from and for our Community User Groups.   P.S. Have an event or success story to share? Reach out to us – we’d love to feature you!

Top Solution Authors
Users online (5,044)