web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply to Each Multiple...
Power Automate
Answered

Apply to Each Multiple Email

(0) ShareShare
ReportReport
Posted on by 92

Good Morning All,

 

I am using one template from Flow to send a weekly report in HTML to the Sales manager for Open Opportunities.

 

After researching a bit I figured out how to get the Account Names into the Account column in the HTML table.

 

 

My issue now is I cannot insert the HTML table into the email without it being under the "Apply Each" action. I now get an email for every opportunity created (30 or so) Is there a way I can get the list of opportunities sent in 1 email ?

 

 

 

 

Categories:
I have the same question (0)
  • clubinski Profile Picture
    92 on at

    screenshot-us.flow.microsoft.com-2019.05.24-09-07-08 (1).png

     

     

    Here is a screenshot of my flow configuration.

     

     

    Any help would be appreciated,

    Thanks

     

    Chris 

     


     

     

     


     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi, 

     

    A few points to consider here: 

     

    1. By putting the "Create a HTML Table" in the foreach loop, you are creating so many HTML tables and as the "Send Email" action depends on this, you are unable to move that action out of the loop. 

    2. You can follow this: "Initialise an Array Variable outside of the loop" Inside the loop "Append to array variable", outside the loop, create a HTML table with custom headers and then finally send the email action with the output table. 

     

    If this answers your query, please mark it as a solution.

     

    Thanks,  

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Just to add, so that it is convenient, here is how you can create the HTML table with custom headers from the array: 

    1. Choose the Create HTML table action -> Select the array in the from option -> Set the Include Headers to yes -> Select the Columns as Custom -> In the first row, type the name of the header you want and in the value, type this expression -> @item()?[‘object name from array’]. (here, the object name from array corresponds to the logical name of the field that you are bringing in from Dynamics). 


    @yashag2255 wrote:

    Hi, 

     

    A few points to consider here: 

     

    1. By putting the "Create a HTML Table" in the foreach loop, you are creating so many HTML tables and as the "Send Email" action depends on this, you are unable to move that action out of the loop. 

    2. You can follow this: "Initialise an Array Variable outside of the loop" Inside the loop "Append to array variable", outside the loop, create a HTML table with custom headers and then finally send the email action with the output table. 

     

    If this answers your query, please mark it as a solution.

     

    Thanks,  


     

    Hope this solves you query. If it does, please mark it as a solution. 

     

    Thanks, 

  • clubinski Profile Picture
    92 on at

    @yashag2255 wrote:

    Just to add, so that it is convenient, here is how you can create the HTML table with custom headers from the array: 

    1. Choose the Create HTML table action -> Select the array in the from option -> Set the Include Headers to yes -> Select the Columns as Custom -> In the first row, type the name of the header you want and in the value, type this expression -> @item()?[‘object name from array’]. (here, the object name from array corresponds to the logical name of the field that you are bringing in from Dynamics). 


    @yashag2255 wrote:

    Hi, 

     

    A few points to consider here: 

     

    1. By putting the "Create a HTML Table" in the foreach loop, you are creating so many HTML tables and as the "Send Email" action depends on this, you are unable to move that action out of the loop. 

    2. You can follow this: "Initialise an Array Variable outside of the loop" Inside the loop "Append to array variable", outside the loop, create a HTML table with custom headers and then finally send the email action with the output table. 

     

    If this answers your query, please mark it as a solution.

     

    Thanks,  


     

    Hope this solves you query. If it does, please mark it as a solution. 

     

    Thanks, 


    @yashag2255   

     

    I added the initialize variable outside before the For Each Loop. Then in the For Each loop added the Append to array variable.

     

    From there I created the HTML table, but the issue is the columns "Account Name" is not displaying. That is What the "Get Record" was being used for.

     

     

    Here is a picture of what I current have, I believe I may have something screwed up.

    3.PNG

     

    Please advise,

     

     

     

  • clubinski Profile Picture
    92 on at

    @yashag2255

     

    I believe the array intitalize and append is not right. I did that and added that expression to the table but the Action Name field does not display.

     

     

     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey! Over here, please check the Value field in Append to variable. You are pointing it to the variable itself, Instead, the value should point to the D365 record. 


    @clubinski wrote:

    @yashag2255 wrote:

    Just to add, so that it is convenient, here is how you can create the HTML table with custom headers from the array: 

    1. Choose the Create HTML table action -> Select the array in the from option -> Set the Include Headers to yes -> Select the Columns as Custom -> In the first row, type the name of the header you want and in the value, type this expression -> @item()?[‘object name from array’]. (here, the object name from array corresponds to the logical name of the field that you are bringing in from Dynamics). 


    @yashag2255 wrote:

    Hi, 

     

    A few points to consider here: 

     

    1. By putting the "Create a HTML Table" in the foreach loop, you are creating so many HTML tables and as the "Send Email" action depends on this, you are unable to move that action out of the loop. 

    2. You can follow this: "Initialise an Array Variable outside of the loop" Inside the loop "Append to array variable", outside the loop, create a HTML table with custom headers and then finally send the email action with the output table. 

     

    If this answers your query, please mark it as a solution.

     

    Thanks,  


     

    Hope this solves you query. If it does, please mark it as a solution. 

     

    Thanks, 


    @yashag2255   

     

    I added the initialize variable outside before the For Each Loop. Then in the For Each loop added the Append to array variable.

     

    From there I created the HTML table, but the issue is the columns "Account Name" is not displaying. That is What the "Get Record" was being used for.

     

     

    Here is a picture of what I current have, I believe I may have something screwed up.

    3.PNG

     

    Please advise,

     

     

     


     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Also, please leave the value in the Initialise variable as blank.


    @yashag2255 wrote:

    Hey! Over here, please check the Value field in Append to variable. You are pointing it to the variable itself, Instead, the value should point to the D365 record. 


    @clubinski wrote:

    @yashag2255 wrote:

    Just to add, so that it is convenient, here is how you can create the HTML table with custom headers from the array: 

    1. Choose the Create HTML table action -> Select the array in the from option -> Set the Include Headers to yes -> Select the Columns as Custom -> In the first row, type the name of the header you want and in the value, type this expression -> @item()?[‘object name from array’]. (here, the object name from array corresponds to the logical name of the field that you are bringing in from Dynamics). 


    @yashag2255 wrote:

    Hi, 

     

    A few points to consider here: 

     

    1. By putting the "Create a HTML Table" in the foreach loop, you are creating so many HTML tables and as the "Send Email" action depends on this, you are unable to move that action out of the loop. 

    2. You can follow this: "Initialise an Array Variable outside of the loop" Inside the loop "Append to array variable", outside the loop, create a HTML table with custom headers and then finally send the email action with the output table. 

     

    If this answers your query, please mark it as a solution.

     

    Thanks,  


     

    Hope this solves you query. If it does, please mark it as a solution. 

     

    Thanks, 


    @yashag2255   

     

    I added the initialize variable outside before the For Each Loop. Then in the For Each loop added the Append to array variable.

     

    From there I created the HTML table, but the issue is the columns "Account Name" is not displaying. That is What the "Get Record" was being used for.

     

     

    Here is a picture of what I current have, I believe I may have something screwed up.

    3.PNG

     

    Please advise,

     

     

     


     


     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    I have tested this one and it works  in my environemnt. Kindly make the changes I have suggested. Can you please share the formula expression part of the flow (it somehow got cut off in the scereenshot)

     

    Thanks,


    @clubinski wrote:

    @yashag2255

     

    I believe the array intitalize and append is not right. I did that and added that expression to the table but the Action Name field does not display.

     

     

     


     

  • clubinski Profile Picture
    92 on at

    @yashag2255 wrote:

    I have tested this one and it works  in my environemnt. Kindly make the changes I have suggested. Can you please share the formula expression part of the flow (it somehow got cut off in the scereenshot)

     

    Thanks,


    @clubinski wrote:

    @yashag2255

     

    I believe the array intitalize and append is not right. I did that and added that expression to the table but the Action Name field does not display.

     

     

     


     


    Added the changes as you advised.

     

    Here is the error I receive when trying to save the flow

     

    error.PNG

     

    Here is the screenshot showing the layout for the HTML Table with your expression

     

     

    Array4.PNG

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey! Please replace "object name from Array" with the logical name of the dynamics field. This refers to the object names in the array that we are creating. 


    @clubinski wrote:

    @yashag2255 wrote:

    I have tested this one and it works  in my environemnt. Kindly make the changes I have suggested. Can you please share the formula expression part of the flow (it somehow got cut off in the scereenshot)

     

    Thanks,


    @clubinski wrote:

    @yashag2255

     

    I believe the array intitalize and append is not right. I did that and added that expression to the table but the Action Name field does not display.

     

     

     


     


    Added the changes as you advised.

     

    Here is the error I receive when trying to save the flow

     

    error.PNG

     

    Here is the screenshot showing the layout for the HTML Table with your expression

     

     

    Array4.PNG


     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard