cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
v-monli-msft
Community Support
Community Support

Hi @Anonymous,

 

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.

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.
 
 

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

 

Anonymous
Not applicable

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

Thank you! I was able to get this working.

Anonymous
Not applicable

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.

Nice Solution

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

abhi0698273
Regular Visitor

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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (3,000)