cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Collector
Kudo Collector

Sharepoint List to Html Table in Send email

Hello, 

 

can anybody tell me what is to correct way to parse a SHP List with 20+ colls in a way that only selected collumns are outputted to a html table in a send mail action. I want to create a flow that runs daily to send summary emails (and no, SHP alerts are not a acceptable workaround 😞 also It needs to be in one email only).

 

Rant: Shouldnt this be trivial? I have spent more than 3hours trying to piece this together 😞 unfortunately I am unable to find reference for Data operations Actions (can anyone please point me to the right direction, I would doubly appreciate if it had ms flow ready examples) /endrant

 

I have tried multiple combinations, the one that makes the most sense:


er.png

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Regular Visitor

Re: Sharepoint List to Html Table in Send email

Use the Select action from Data Operations. Below is part of a flow that emails me my active (that's what the filter is for) planner tasks.

 

Send Task List.png

View solution in original post

24 REPLIES 24
Highlighted
Community Support
Community Support

Re: Sharepoint List to Html Table in Send email

Hi @avt,

 

Have you checked the Create HTML table Action?

A better way is use the Create HTML table Action to build the table, if you only need to send the HTML body to yourself, then choose the Send me Email Notification action, if others would be involved, change it to the Send an Email Action.

For Send an Email Action, make sure the Is HTML is set to Yes under Advanced options.

20.PNG

21.PNG

If you need any further help on this, please post back.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Kudo Collector
Kudo Collector

Re: Sharepoint List to Html Table in Send email

Thank you, but as I said I need only selected collums not all of them because the list has 20+ colls and the formating is terrible with more than ten.

 

I can select the wanted collumns with the Compose Action in Aplly to each container but cannot merge them into a single table after that with Join Action.

 

Funny enough the Join Action works ok If I skip the Compose Action but than once again I am stuck with all the inwanted collums, is this a bug? (The invalid template error in screenshot in my first post)

Highlighted
Regular Visitor

Re: Sharepoint List to Html Table in Send email

Use the Select action from Data Operations. Below is part of a flow that emails me my active (that's what the filter is for) planner tasks.

 

Send Task List.png

View solution in original post

Highlighted
Kudo Collector
Kudo Collector

Re: Sharepoint List to Html Table in Send email

Thank you, it worked, its perfect, you saved my day 🙂

Highlighted
Anonymous
Not applicable

Re: Sharepoint List to Html Table in Send email

I just built this exact example flow with a few more conditions, trying to figure out in the above if I wanted to compose the due date into a nicer looking format, how I could pull that off for each table entry.

Highlighted
Anonymous
Not applicable

Re: Sharepoint List to Html Table in Send email

 Nevermind, I dfigured this out. Instead of having it compase seperately, I added the following directly into the table:

@formatdatetime(item()?['dueDateTime'],'MM/dd/yyyy')

 

works nicely as long as there is a due date attached, working on a conditional statement now for when it is empty, still not working quite right.

 

Highlighted
Regular Visitor

Re: Sharepoint List to Html Table in Send email

Try this. It shows N/A if there's no due date. You need the second coalesce() since the false option is still evaluated in the if function.

 

@if(equals('01/01/2000',formatDateTime(coalesce(item()?['dueDateTime'],'2000-01-01T00:01:00Z'),'dd/MM/yyyy')),'N/A',formatDateTime(coalesce(item()?['dueDateTime'],'2000-01-01T00:01:00Z'),'dd/MM/yyyy'))

Highlighted
Frequent Visitor

Re: Sharepoint List to Html Table in Send email

@Anonymous

 

I am writing rows from an Excel spreadsheet to a HTML table that will be sent via email. I understand you were able to modify the format of the date by directly entering the format code into the table? I'm not sure I know how to do this - could you take a look at my current flow and help me determine where to place the format code (I currently have it in the Compose action which is not working)? Thanks in advance

 

 

EmailFlow.png 

Highlighted
Anonymous
Not applicable

Re: Sharepoint List to Html Table in Send email

Hi,

I wrote the code directly into the box on the 'Select' area:

@if(equals('01/01/2000',formatDateTime(coalesce(item()?['dueDateTime'],'2000-01-01T00:01:00Z'),'MM/dd/yyyy')),'Not Set',formatDateTime(coalesce(item()?['dueDateTime'],'2000-01-01T00:01:00Z'),'MM/dd/yyyy'))

 

I made it conditional, as in my case I was pulling a date from a Task due date, which may or may not be assigned.

 

Hit the x to remove the variable below in the field you want to compose the date, and insert your code directly into the table on the 'Select' area. Eliminate the compose completely.

 

 

Highlighted
Frequent Visitor

Re: Sharepoint List to Html Table in Send email

@Anonymous,

 

Thank you for your quick reply. I attempted to insert the format line into the Select action, but my results are unexpected. I'm assuming I need to adjust the format line so that the format line is read as a function as opposed to text. Do you know if I need to tweak the format line so that it works properly?

 

Here's my Select action:

Select.PNG

 

And here's an example from the output:

 

 

 

 

 

Output.PNG

Output table.PNG

Highlighted
Anonymous
Not applicable

Re: Sharepoint List to Html Table in Send email

Hmm, I don;t remember exactly, but I may have switched into the advanced mode to insert the code there before saving. Made sure to add the open/close quotes around it to when inserting.

 

Edit: Also, are you sure the name of the value is Blocked_Date? I havn't seen that format yet, if unsure, add it to the table in the GUI, and then switch into advanced mode to see its real name.

Highlighted
Frequent Visitor

Re: Sharepoint List to Html Table in Send email

@Anonymous, thank you for your continued help. I finally figured out it after looking at the syntax of the formateDateTime function. I had some curly brackets inserted incorrectly and now it is performing correctly. Here's the new line that works: 

@{formatDateTime(item()?['Blocked_Date'],'MM/dd/yyyy')}
Highlighted
Advocate I
Advocate I

Re: Sharepoint List to Html Table in Send email

How it's possible to get Data Operator "Select" MAP values using Recurrence trigger (or what is that)? Are these dynamic?
I can't find a solution to get the wanted values in to the table, without FOR EACH function. Any help?
Capturegdsfgsd.JPG

 

Highlighted
Regular Visitor

Re: Sharepoint List to Html Table in Send email

I have implemented the solution as indicated and I am still getting the problem of all the fields from my SharePoint list appearing in the body of the email. What am I missing or not doing?

 

Has anyone created this successfully pulling data from a SharePoint list?

Highlighted
Advocate I
Advocate I

Re: Sharepoint List to Html Table in Send email

I don't remember all my tests, but at the end I have created CSV table and got filtered sharepoint list table in my approval email. I add flow steps and email screenshot. 

Flowsteps.JPGSelectedTable.JPG

Highlighted
Regular Visitor

Re: Sharepoint List to Html Table in Send email

How are you able to create your Select not within Apply to each block?

 

My logic looks like this:

Recurrence --> Get Items --> Filter Array --> Apply to each --> Select --> Create HTML Table --> Send Email

 

The Select is nested within the Apply to each but it should be like yours and exist outside of it. I tried to do it that way but when I select the output from Filter Array as the input to Select, it automatilcally nests in within the Appy to each.

Highlighted
Advocate I
Advocate I

Re: Sharepoint List to Html Table in Send email

As I remember the "trick" I have done:
In the Select action, for the first time adding the *From field, should not be used the Fillter array body, but Get items value. Further, in the *Map fields select necessary culumns from  "Get items".
Save the flow. 
After that, you need to edit a flow and modify Select action's *From field. For that, delete Get items value and put previous Filter array Body. In this case apply to each action won't appear. 


Highlighted
Regular Visitor

Re: Sharepoint List to Html Table in Send email

Thank you so much for that! I implemented your changes and my flow works correctly now!

 

Highlighted
New Member

Re: Sharepoint List to Html Table in Send email

@ARnosa, thank you so much for this "trick"! I've been beating my head against a wall for days trying to figure out how to keep the For Each from being added to my Select. One note to add. As I've been working on it further, I've found that any time I need to bake edits tot he mapping of the Select, I need to once again change the From back to the Get Items... make my mapping edits... then change the From back to the Filter Body. If don't do that it adds the dreaded For Each, then I have to start over again with my Select.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,030)