web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ForAll and SendMail = ...
Power Apps
Unanswered

ForAll and SendMail = not possible?

(0) ShareShare
ReportReport
Posted on by 914


Hi!

 

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.

 

 orderscreen.png

 

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!

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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...

     

    Paul

  • BitLord69 Profile Picture
    914 on at

    Hi!

     

    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?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 339 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard