MS Flow - Email Template HTML breaking after adding ItemUrl in href

Copper Contributor

I have a simple requirement of sending an email with custom ItemUrl and ID in the email body.
Current Scenario
 1.png
 
 
ItemUrl variable contains - https://www.google.com?id=@{triggerBody()?['ID']}. Here Id is incrementing.

2.png

Problem Statement

I am getting an email but the at the same time the url openly displayed in the email body which I want as href: Here is the email

 3.png

Solution I have tried:

Here what I have tried but no luck: I provided the ItemUrl inside <a href="@{variables('ItemUrl')}"</a>. But my HTML breaks and I cannot return to normal email body. In short, I can only see HTML markup, which is a bad experience for business user.

 

4.png

Expected output : ItemUrl should be inside href and at the same time email body is also in readable format

5.png

Any help is highly appreciated. Thanks.

 

 
4 Replies

Hi @Matt1122 

 

Hope you are well.

 

If I understand you right, I think you missed a step in your tag. Just add Click here in between the A href tag and the </a> tag.

 

Try <a href=" https://www.google.com?id=@{triggerBody()?['ID']}">Click here</a>

 

Hope that does the trick!

 

Cheers

Damien

@Damien_Rosario 

 

Thanks for your response.

I tried this but it didn't work.

 

If I provide the direct link in href it accepts and HTML tag is enabled. But as soon as I provide ListItemID to it, it breaks. Screenshot attached

 

The actual problem here is in forming the url in ItemUrl variable.

 

Options Id tried, with multiple combinations.

Here ID is ListItemId

?id=[%ID%]

?id=['ID']

?id=@ID

 

Link hardcoded HTML is enabled

6.PNG

 

HTML breaks after providing dynamic ID

7.png

 

 

Please let me know if any solution.

 

 

 

 

Hi @Matt1122 

 

Regarding your HTML question, your observation is correct. 

 

I tend to get my HTML sorted before putting it into Power Automate and then running tests and tweaking things from there.

 

I use programs like Notepad ++ to test my designs before they go into Power Automate (save the file as a *.html for testing in your web browser).

 

If the URL is still an issue, try removing the @ (see below).

 

capture20200826110444639.png

Output:

 capture20200826112818203.png  

Click onto 'Click here' results in ID 3 (which is correctly drawn from SharePoint):

 

capture20200826112958275.png

 

Hope that helps?

 

Cheers

Damien

Hi @Damien_Rosario 

 

Thanks for your help!

Your answer is partially correct. I have mentioned this scenario in my query as well. So by using this approach I am getting proper href link in my incoming emails. However the issue here is with HTML tags in MS Flow email template body like in your screenshot <p><a>Click here</a></p>. 

 

What I am trying to do here is to have href link in incoming emails and no HTML tag view in MS Flow email template body 🙂 Hope you get it.

 

By the way I am currently running my flows using this approach only.