Showing results for 
Search instead for 
Did you mean: 
Power Participant
Power Participant

ForAll and SendMail = not possible?



I'm making an internal ordering system where my department gets orders from people all around the organisation. They submit their respective orders using another app, saving the data on our in-house SQL server.


In the second app I aggregate the separate orders into a single one that will eventually be sent to the supplier. For each order row the name and email of each person is stored, along with information about the product. The screen shot shows the aggretated list in the lower half, where one person can have multiple entries.




From this list I have made a grouped collection, since each person needs to receive only one email with all the products he or she ordered. I do this with:


ClearCollect(cGroupedOrders; AddColumns(GroupBy(gOrderraderOrderScrn.AllItems; "Bestallare"; "BestEpost"; "Orderrad"); "Ordertotal"; Sum(Orderrad; Summa)))  and it works like a charm.


Here's (finally) my problem: How do I send an email to each of the recipients in the cGroupedOrders collection?


I tried doing a ForAll(cGroupedOrders;  Office365.Sendmail(...)) but I get the message that I cannot use SendMail in ForAll.


What options do I have? Is it possible to use the SendMail function at all, or do I have to do a Flow instead?


Thanks for any input you might have!

Not applicable

I think you have to do it in flow. ForAll does everything in parallel, so its not like a ForEach which iterates through a collection one at a time. 


I'd pump it into Flow and do it there...





Thanks for the input! I've been looking at Flow a bit now, and I have no clue how to do that.


Preferably I don't want to have to loop in PA and run the flow multiple times, so how do I instruct Flow to loop through my collection and format/create the email? Is that even possible?

Helpful resources


Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users


We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (68,687)