MSFlow sending multiple emails from SharePoint list

Copper Contributor

I've built a flow that is nearly perfect!

 

Just for background:

 

I've got a PowerApp that lets our end users make a Stationery Order, and exports the end users order to a SharePoint List. That bits all working great.

 

Id like to then take this submission in the SharePoint List and get it to our purchasing team, via email- so over to PowerAutomate/Flows!

 

I've built a flow, that does exactly that, and tidies up the list afterwards, those with a much better understanding of Flows will immediately spot my issue.

 

MSFlow.png

 

I receive an email with the exact data I needed from the list, great!

Order email.png

But my flow in its current setup it sends 1 email "order summary" for each unique stationary item. So i placed an order for 5 different items, so 5 emails!

Order Emails.PNG

 

I can see why its doing this as its triggered by a new list submission, but I'm unsure how to fix it, id like it to collect the entire list data when something is submitted, and send 1 email but I'm stuck- any ideas on how to achieve this?

 

I need this to remain automated whenever a new list item(s) are detected as its coming from a PowerApp, and I have to avoid using Flow scheduling, as multiple people may use this order form at once (large staff base), so i cant have orders getting mixed up/combined if its only looking every day or hour. This is also why I clean up the list and delete all entries at the end of my flow so its ready for the next order.

 

Im hoping im missing a very obvious step or flow action, any advice would be appreciated, thanks!

2 Replies
You could use PowerApp to trigger the flow, instead of triggering for each item.

I don't know how your App is built,... but if the user creates one list item after another, you could have a button in the app called "Finished, send my order" or something like that. This button can be used to trigger a flow and potentially include parameters so the flow knows which of the items from the list to process.

Or, if the App is built in a way where the user adds all items and then "submits" them and the App creates the list items in one go/batch, you could just trigger a flow after the items were submitted.

This way the flow triggers only once the user has created the list items and you don't need to set up a scheduled flow

@NDCOPC as you've realised, the initial problem is that the flow will trigger for each individual item ordered - i.e. each time an item added to the list. So in your Power App you need to be generating a unique order number, patching that order number to a column in the list for each item ordered then using the Power Apps (v2) trigger with the unique order number as an input parameter. Then you can use the SharePoint get items action from your list with a filter query using the order number. That will get all the items with that order number, then your Select, create html table and other actions will run as you intend.

 

I hope to have some time this afternoon to demonstrate this and I'll post back here asap.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)