Marian Simonca
Marian Simonca

Reputation: 1562

Insert URL column in a HTML table using Azure Logic App

I am creating a Logic App on Azure and in this process I have to create a HTML table with some data, insert that table in an email body and send that email using SendGrid.

Almost everything works, except that my table should have a column containing a URL to some website.

The problem is that somehow the Create HTML table action does not return <a> as HTML tag but &lt;a&gt; and the Send email's body (even if it's considered HTML content) can't process/interpret that.

I am using a concat(string1, string2 .. ) Expression to build the URL and I think it builds it correctly. The output look ok, only raw output is messed up.

Create HTML table action returns this:

Output:

The raw output can be interpreted here

Raw Output:

<td>&lt;a=&quot;https: ...

This is how the Output is injected into the email body of Send Email:

The raw output will be added

If the raw output could be changed to be in a more HTML format, the email body will parse it and display the URL in a correct way. (I'm not sure if I expressed myself very well. But even if I create a simple html file with that raw output, the a tag will be displayed in browser as simple text...)

Any ideas? I think that if I replace the concat() expression and generate the URL before, the raw output of Generate URL table will still mess up the final result.

Maybe if there is a way to stop the replacement of < and > with &lt; and &gt; it will work, but I don't know how to do that..

Upvotes: 1

Views: 1541

Answers (1)

Hury Shen
Hury Shen

Reputation: 15754

For this problem, I initialize a variable to simulate your situation and we can just replace the &lt; with < and replace the &gt; with >. Then the send email action will work fine. Please refer to the steps below: enter image description here

The whole expression is:

replace(replace(body('Create_HTML_table'), '&lt;', '<'), '&gt;', '>')

Hope it helps~

Upvotes: 1

Related Questions