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