cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Links IN an HTML table

Hi all,

 

Normally I create notificaiton emails from a flow that use SharePoint list data I can just create links by using the <a href""> tags, however I am running into a problem where I am trying to include a link to each item inside an HTML table that will go in the body of the email. 

 

  • If I just add the [Link to Item] to the Select Action, I get a working link but it is very long and ugly 🙂
  • If I try to wrap it <a href="[Link to Item]">Link</a> then I get plain text including the tags with no active link.
  • If I try to wrap it <a href=[Link to Item]>Link</a> (no quotes) then I get plain text tags, with the long original link active

Its the end of a long day and I am sure I am missing something obvious, but if you could help me out I would really appreciate it! 

 

screenshot.jpg

9 REPLIES 9
Highlighted
Community Support
Community Support

Re: Links IN an HTML table

Hi @Creative_Sense,

 

To make a link active in the table, I think the [Link to Item] dynamic content is the only available way so far. 

 

Regards,

Mona

 

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

Re: Links IN an HTML table

I figured out a work around to this. The reason the HTML Tables are showing as actual text is because they're being HTML encoded.

 

You can undo this by running a "Compose" action after the HTML Table that replaces &lt; with < and &gt; >.

 

For example:

replace(replace(body('Create_HTML_table'), '&lt;', '<'), '&gt;', '>')
 
The danger in doing this is that if there is a place where input originates from a user, they may be able to inject links in what will be sent via email. These could be potentially to malicious sites. Theoretically it may be possible to inject JavaScript this way, but in reality most email clients will not execute scripts within emails.
 
In my particular case I wrote things so the links could only be injected via my transformations in the flow. (I did this by doing a compose replace to completely remove all &lt; and &gt; before injecting my link that would then be HTML encoded). This made it so only the links I wanted in there would have the encoded values and could be reversed back out.
 
 
Highlighted
New Member

Re: Links IN an HTML table

Of your first three options, which one did you use:

 

 

  • If I just add the [Link to Item] to the Select Action, I get a working link but it is very long and ugly 
  • If I try to wrap it <a href="[Link to Item]">Link</a> then I get plain text including the tags with no active link.
  • If I try to wrap it <a href=[Link to Item]>Link</a> (no quotes) then I get plain text tags, with the long original link activ

 

Highlighted
Advocate II
Advocate II

Re: Links IN an HTML table

I tried them all and since none worked, I just put a (non-item specific) link to the list in the email above the table. Its not ideal but its better than a giant messy table

Highlighted
New Member

Re: Links IN an HTML table

Thank you! I was able to get this working.

Highlighted
Anonymous
Not applicable

Re: Links IN an HTML table

Hi! Thanks for the answer, it worked for me too.

 

I would also suggest to replace ampersands from '&amp;' to '&', as I had to do too.

Highlighted
Regular Visitor

Re: Links IN an HTML table

Nice Solution

Highlighted
Helper I
Helper I

Re: Links IN an HTML table

Can you please share the image of output and code Thanks 🙂

Highlighted
Regular Visitor

Re: Links IN an HTML table

As It is observed, CreateHTMLTable converts < to &lt; and > to &gt; when reading data from array, as it considers < and > as a input data.
While to have <a> markup to work, replace approach works every time.

Example Table contains -

 

{
...
link : "<a href= \"https://samplelink.tonewplace.com/person\">click here</a>"
...
}

 

gets converted to something below due to CreateHTMLTable -

 

<tr>&lt;a href= &quot;https://samplelink.tonewplace.com/person&quot;&gt;click here&lt;/a&gt;

 

So, When we replace as said earlier
Example table becomes -

 

{
...
link : "::a href= \"https://samplelink.tonewplace.com/person\":;click here::/a:;"
...
}

 

After CreateHTMLTable, result is similar to  -

 

<tr>::a href= &quot;https://samplelink.tonewplace.com/person&quot;:;click here::/a:;

 

 

So, now using Compose to replace the combination of characters, used earlier -

 

 

<tr>::a href= &quot;https://samplelink.tonewplace.com/person&quot;:;click here::/a:;

 

 

becomes -

 

<tr><a href= &quot;https://samplelink.tonewplace.com/person&quot;>click here</a>

 

 

Now above result can successfully be used as part of email. This method relies on combination of characters used for < and > respectively, so choose carefully as per data that needs to be shared over email.

 

This solution worked perfectly for me.😊

Helpful resources

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

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (7,053)