cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Sending single mail after creating multiple list items in sharepoint from power automate.

Hi All,
I want to create a workflow using Power automate and I am starting this workflow on item created. Now when I am adding multiple items at a time it is starting workflow for each item but I want to send all items details in single mail and also I want to know whether the mail triggered or not for that group of items.

I'm inserting common I'd and choice column(yes/no) for group of items.

Can someone please let me know how can I achieve this.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Hi @BKGOUD ,

Is the solution I provided above helpful in your scenario?

 

Within the "Send email" action, please do not reference the dynamic content value from the "Get items" action. The Output of the "Get items" action is a table, if you reference the Dynamic content value from the "Get items" action directly, actually, you are referencing a single column table value, so it would add a "Apply to each" action outside the "Send email" action automatically.

 

Please take a try with my solution, and convert the retrieved records as Html Table using "Create HTML Table" action. Then embed the Html Table dynamic content within the "Send Email" action.

 

For your second question, I think you could consider configure "Create HTML Table" as a custom HTML Table as below:

10.JPG

Specify the desired column names within the Header, and within the Value part, please use the following formula to reference column value from the current loop item:

item()?['Id']
item()?['Title']
item()?['Column3']

...

...

You could defined your expected HTML Table format within the "Create HTML Table" action, then put the Output dynamic content within the email body.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Highlighted
Memorable Member
Memorable Member

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Hi @BKGOUD ,

 

It seems like your workflow needs to trigger on the parent of the items and not on the item itself. If you need to trigger on the item then it is the expected behavior to trigger for each. I don't know a lot about your scenario, but the approach I would recommend is something like this:

  1. If you don't already have a status or a flag field on the parent item.. Say for this example, we have a status of "Pending" (default status) and "Complete". When all the items have been added to the parent, update the status to "Complete".
  2. Update the workflow aka "flow" in Power Automate to trigger on update of the parent item and filter where status = "Complete". It would look something like this using the "Common Data Service (current environment)" connector which is the one I recommend:
    2020-04-05_18-43-06.png

     

    More info on Power Automate and CDS: https://docs.microsoft.com/en-us/power-automate/connection-cds

  3. Include a "List records" Action/Step in your flow to retrieve your items and then, you can formulate the body with the list of items and include in your email step.
    2020-04-05_18-45-44.png

     

Hope this helps!

Highlighted
Helper I
Helper I

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Thanks for your help.
I'm using two lists here. First one is actual list, in which I'm inserting multiple items at a time with common id and flag value as No. Another list inserted by single item with common id(i.e from first list). Then I'm using when item is created.
Highlighted
Memorable Member
Memorable Member

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Thanks, so my approach would work. Trigger the email on the 2nd list (single item) with the common id, but you have to trigger only when all the items have been added, so you have to tell the 2nd list when it's done (e.g. change the status)

Highlighted
Community Support
Community Support

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Hi @BKGOUD ,

Do you want to fire your flow only once time, and then send an email including multiple records details?

 

Based on the needs that you mentioned, I agree with your solution. I think two Lists could achieve your needs. On your side, you just need to set up a flow based on your second list using "When an item is created" trigger of SharePoint connector.

Then retrieve related records from your first List based on the common Id value (using "Get items" action). After that, you could convert the retrieved results into a HTML table, then embed the HTML Table into your email body.

 

I have made a test on my side, please consider take a try with the following workaround:

8.JPG

 

9.JPG

Within the "Filter array" action, click "Edit in advanced mode", type the following expression:

@equals(item()?['Id'], triggerBody()?['Id'])

Note: The Id represents the common id value that you mentioned in your First List and Second List. On your side, you should replace it with actual field name from your First List and Second List. The format as below:

@equals(item()?['IdColumnInFirstList'], triggerBody()?['IdColumnInSecondList'])

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper I
Helper I

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Hi @v-xida-msft ,

 

Thanks for your great support. 

I have tried your way it works fine me. In my first sharepoint list i have few columns. When im creating multiple items, except one column, remaining columns values for each item are similar. So when i'm choosing this columns in mail body it is going to For Each loop and sending multiple mails to me. 

 

Foe Ex: Column1    Column2    Column3

              x                    test         ABC

              y                    test         ABC 

 

i'm appending Column1 values to one string var and passing that variable in email body.

 

Also please let me know how would i know whether the email sent to for a group of items which are inserted with common id.

 

Mail Body Should be: 

Column1 : X,Y

Column2 : test
Column3 : ABC

 

 

Highlighted
Community Support
Community Support

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Hi @BKGOUD ,

Is the solution I provided above helpful in your scenario?

 

Within the "Send email" action, please do not reference the dynamic content value from the "Get items" action. The Output of the "Get items" action is a table, if you reference the Dynamic content value from the "Get items" action directly, actually, you are referencing a single column table value, so it would add a "Apply to each" action outside the "Send email" action automatically.

 

Please take a try with my solution, and convert the retrieved records as Html Table using "Create HTML Table" action. Then embed the Html Table dynamic content within the "Send Email" action.

 

For your second question, I think you could consider configure "Create HTML Table" as a custom HTML Table as below:

10.JPG

Specify the desired column names within the Header, and within the Value part, please use the following formula to reference column value from the current loop item:

item()?['Id']
item()?['Title']
item()?['Column3']

...

...

You could defined your expected HTML Table format within the "Create HTML Table" action, then put the Output dynamic content within the email body.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper I
Helper I

Re: Sending single mail after creating multiple list items in sharepoint from power automate.

Hi @v-xida-msft,

 

Thanks for your help.

 

Is it possible to get the below output in mail body.

For Ex: Column1    Column2    Column3

              x                    test         ABC

              y                    test         ABC 

 

Mail Body Should be: 

Column1 : X,Y

Column2 : test
Column3 : ABC

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (8,245)