Hello,
I have a SP List "Orders" with the following columns:
- Order_Id
- Logistic_Email
- Delivery_Date
- Article
- Quantity
Exemple:
Order_id | Logistic_Email | Delivery_date | Article | Quantity |
1 | logistic1@mail.com | 01-08-2023 | Ball | 5 |
1 | logistic1@mail.com | 01-08-2023 | Frisbee | 10 |
2 | logistic2@mail.com | 01-08-2023 | Beach flag | 2 |
2 | logistic2@mail.com | 01-08-2023 | Umbrella | 3 |
2 | logistic2@mail.com | 01-08-2023 | Goodies | 10 |
7 days before the delivery date, I want to send per order_id an email with the list of articles of the order.
I'm very confusing in the order of steps in the loop:
- Append to array
- Set the order_id in a variable
- Test if the order_id changes
- Send the mail
- Reset the array
How can I know in the end of the loop, if it's the last article of the order and then, I can send the mail.
Also, I can have an order with only one article that match with 7 days before delivery so I have to test the length of the getitems action.
Can someone guide me?
Thanks, it works perfectly as I want
Group by order ID using the method in the link below, then look through the final array to send the grouped data in an email for each order
https://johnliu.net/blog/2018/6/do-group-by-in-flow-with-two-simple-elegant-loops
Because the flow must send one mail per order, there are 2 differents orders
First order sent to logistic1
Second order sent to logistic2
why would your order id change? Looks like an easy flow. Have a recurring flow run every morning, filter your get items by Delivery_Date eq 'formatDateTime(addDays(utcNow(),7),'MM-dd-yyyy')'
that will only return orders that need to be delivered in 7 days. Then for each loop through the records and send an email for each order.
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492