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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trying to use Flow to ...
Power Automate
Answered

Trying to use Flow to send email containing HTML table using 2 linked sharepoint lists as the datasource

(0) ShareShare
ReportReport
Posted on by 380

I am fairly new to Power Automate but have a couple of very simple Flows using a single Sharepoint list as the datasource working at the moment. My latest attempt is using 2 Sharepoint lists that are linked by a common ID.

 

I just can't seem to find any posts that are doing the exact thing I want to do. 

 

My screenshots show a working Flow where I am only using 1 Sharepoint list however I need to add 3 columns from another list to complete my table - the 2 lists are linked on a field in both lists called tripid

 

I think I just need to add another GetItems but then that's where it gets confusing for me as the Apply for each pops up automatically and I don't know what to do to finish it off - I've had a few attempts and one of them sent me an email where the data was repeated about 100 times!! - any assistance would be greatly appreciated

 

 

Categories:
I have the same question (0)
  • v-chengfen-msft Profile Picture
    Microsoft Employee on at

    Hi @bobgodin ,

    Please try to use string concatenation to create Html tables.

     

    Here is a test for your reference:

    Here is listA:

    vchengfenmsft_7-1669875590797.png

     

    Here is list B:

    vchengfenmsft_5-1669875196101.png

     

    Here is flow:

    First traverse Alist, get the source of ListA,

    then use get items to get the item in listB that has the same Source as list A,

    and then splicing the data of the two tables into html

    vchengfenmsft_0-1669875087371.png

    vchengfenmsft_1-1669875095603.png

    vchengfenmsft_6-1669875513210.png

     

    Here is result:

    vchengfenmsft_3-1669875108128.png

     

    Best Regards

    Cheng Feng

  • bobgodin Profile Picture
    380 on at

    Hi @v-chengfen-msft thanks for your prompt reply. I can't make it work!

    In your append to string variable action you have <th>Source</th>is this a mistake as the others are <td>tags? I have assumed it was a mistake and used the <td> tags.

     

    I have attached more screenshots of my flow. My 2 Sharepoint lists are TripDetails and Trips.

     

    You can see in the Append to string variable I am wanting to join the 2 lists but this action won't allow me to select the fields from Trips - only TripDetails. In the Create HTML Table action again I can only include fields from TripDetails and not Trips as well.

     

    I must be missing something or have misunderstood your instructions - can you see where I am going wrong?

    thanks 🙂

    flow2.png
    flow3.png
    flow1.png
  • v-chengfen-msft Profile Picture
    Microsoft Employee on at

    Hi @bobgodin ,

    Sorry for my oversight, I didn't tell you.

    The <th> tag defines a header cell in an HTML table.

    An HTML table has two kinds of cells:

    • Header cells - contains header information (created with the <th> element)
    • Data cells - contains data (created with the <td> element)

    The text in <th> elements are bold and centered by default.

    The text in <td> elements are regular and left-aligned by default.

    vchengfenmsft_0-1669944849914.png

    If strings are used to concatenate HTML, there is no need to use the [Create HTML table] action.

    According to my flow, you could get the data of two tables

     

    Best Regards

    Cheng Feng

  • bobgodin Profile Picture
    380 on at

    Hi @v-chengfen-msft I am aware of the difference between header and data cells - what you haven't explained is why you have used <th> tags in the middle of a table row and 3 table definitions - does the <th> tag not go at the beginning like this example?:

    <th>My Header</th>

    <tr>

    <td>Table definition1 </td>

    <td>Table definition2 </td>

    <td>Table definition3 </td>

    <td>Table definition4 </td>

    </tr>

     

    And could you offer any explanation as to why your Flow works and mine does not?

     

    thank you

  • v-chengfen-msft Profile Picture
    Microsoft Employee on at

    Hi @bobgodin ,

    I'm sorry, I just want to emphasize Source, I'm very sorry to trouble you.

    Can you provide a screenshot of the flow failing?

     

    Best Regards

    Cheng Feng

  • bobgodin Profile Picture
    380 on at

    Hi @v-chengfen-msft please see previously posted screenshots for failing Flow

    I will explain exactly what the flow is tying to do:

     

    The first screenshot flow1 shows the Get Trip Details action which connects to Sharepoint list TripDetails and selects records which satisfy the date/time criteria I provide at the beginning of the Flow

     

    Flow2 screenshot shows the Initialise variable where I setup the table headers to hold my data fields - note that there are 4 fields from TripDetails and 3 from Trips.

    In the apply to each 2 action I pass the value from TripDetails - I then have action Get Trips which connects to the 2nd Sharepoint list - Trips and the Filter is where tripid in TripDetails = tripid in Trips

     

    In the apply to each 3 action - THIS IS WHERE IT IS GOING WRONG...the only value I can choose is from TripDetails and so in the subsequent Append to string variable I can only choose data fields from Trip Details and NOT Trips

     

    I understand that I don't need the Create HTML Table at the end so I will remove it

    Hoping you can help solve this.....

  • v-chengfen-msft Profile Picture
    Microsoft Employee on at

    Hi @bobgodin ,

    Please check if the value of [Apply to each 3] is from Trips?

    [Note]:Because there will be two 【Get items】 that may be confused

    Best Regards

    Cheng Feng

  • bobgodin Profile Picture
    380 on at

    Hi @v-chengfen-msft no that is the problem there is only 1 Get Items to select and that is Trip Details - see screenshot flow4.  I think I will try removing Get Items for Trips and re-adding it...

    flow4.png
  • bobgodin Profile Picture
    380 on at

    trien removing and re- adding Trips but still doesn't work...any other ideas @v-chengfen-msft ?

  • v-chengfen-msft Profile Picture
    Microsoft Employee on at

    Hi @bobgodin ,

    I'm so sorry I didn't help you out

    This is a detailed screenshot of my flow.
    I can't judge according to some of your screenshots.
    Could you see something different in my flow than yours?

    vchengfenmsft_0-1669957075175.png

     

    Best Regards

    Cheng Feng

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 463

#1
Valantis Profile Picture

Valantis 463

#3
11manish Profile Picture

11manish 264

Last 30 days Overall leaderboard