I have a Flow, which runs on SharePoint List View, whenever item in View is modified. This Flow should send email with all rows which have value = "Planned delivery date exceeded and data not delivered" in column "Planned delivery date vs due date". With below setting I am sending email, but for each separate row. How can I make it to send one email with all rows which fulfill condition in column "Planned delivery date vs due date"
Solved! Go to Solution.
Hello @zwornik80
You will need to move the send email action outside of the apply to each loop.
Now to get / reference the data you want outside the loop, you will want to do the following:
Add a initialize variable at the top of your flow, with type string.
Next, inside the loop where you were going to send the email, add a append to string variable, and build out what you want your email to look like.
Now outside the loop in your send email action use the string variable in the body of the email.
This will have all the information for each item that you appended to inside the loop.
Proud to be a Flownaut!
Hello @zwornik80
You will need to move the send email action outside of the apply to each loop.
Now to get / reference the data you want outside the loop, you will want to do the following:
Add a initialize variable at the top of your flow, with type string.
Next, inside the loop where you were going to send the email, add a append to string variable, and build out what you want your email to look like.
Now outside the loop in your send email action use the string variable in the body of the email.
This will have all the information for each item that you appended to inside the loop.
Proud to be a Flownaut!
Hi @zwornik80
Try the below and let me know if you face any issues.
1. Use the action named 'Create HTML Table' after the action 'Get items: ...'
2. For the 'From' column in the 'Create HTML Table' action, use 'body('Get item.....')?['value']'
3. Choose 'Custom' from the 'Columns' field. Enter the header and choose the value of the field.
4. Use the output HTML in the mail action.
Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...
Hi @sudharsan1985 Thanks for support. I have followed your advice and used Create HTML Table action but with Columns Automatic. My flow failed with this error:
Hi @Jcook
Thanks for support. Your approach worked OK. Except that my requestor prefers to have data nicely formatted as table in email body
@sudharsan1985 You mean whole body of Get Items as an array or specific columns?
@sudharsan1985 I've put whole body of Get Items into Array and flow run succesfully. But It is sending email per each row. I think I need the same logic as @Jcook suggested, but for HTML Table. So first, table needs to be created, and during loop data should be appended to it. Is this possible for HTML Table?
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
12 |
User | Count |
---|---|
128 | |
53 | |
38 | |
26 | |
21 |