cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zwornik80
Helper III
Helper III

MS Flow: Send email notification for all items, not for each separately

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"

 

Flow.png

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
MVP

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.


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

8 REPLIES 8
Jcook
MVP

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.


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





sudharsan1985
Solution Sage
Solution Sage

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

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:

 

failed.png

Hi @Jcook 

Thanks for support. Your approach worked OK. Except that my requestor prefers to have data nicely formatted as table in email body

Hi, try to pass the data to the 'Create HTML' action as an array, better to use the custom header and field value to avoid unwanted columns as a part of the HTML.
Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

@sudharsan1985  You mean whole body of Get Items as an array or specific columns?

Hi, just vive the header column name and assign the values normally to the html table. Use the custom columns.
Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,058)