web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How do I get flow to s...
Power Automate
Answered

How do I get flow to stop encoding the ampersand in the href in my anchor tag?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

How do I stop Flow from encoding an ampersand in a link in the body of my message?

 

I am sending HTML email and in that mail I want to embed a google analytics link, but it wont work because Flow keeps encoding the ampersand ( & ) to ( & ) which breaks the URL.

 

Here is a sample:

 

href="https://www.google-analytics.com/collect?v=1&tid=UX-1345610741-1&cid=XYZ&t=event&ec=email&ea=open&el=12345678&cs=Assignment&cm=email&cn=contoso

 

 

But if you look at the source in the body of the mail, it has clearly encided the "&" to be "&":

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
Hello,<br>
<br>
<a href="https://www.google-analytics.com/collect?v=1&amp;tid=UX-1345610741-1&amp;cid=XYZ&amp;t=event&amp;ec=email&amp;ea=open&amp;el=12345678&amp;cs=Assignment&amp;cm=email&amp;cn=contoso"></a>
</body>
</html>

 

 

Categories:
I have the same question (0)
  • PieterVeenstra Profile Picture
    13 on at

    IsHTML.PNG

    Did you set Is HTML to Yes?

  • steveshe Profile Picture
    Microsoft Employee on at

    Yes. If you dont do that, then I'm pretty sure you just get the HTML as text and no encoding or unencoding happens. 

  • steveshe Profile Picture
    Microsoft Employee on at

    Sorry Peter, I just realized from my post you might think that I was getting raw HTML in the visibile portion of the email. That is not the case. I just did a View Source on the email and posted the unrendered HTML body for expositive purposes. It all renders correctly, but the link doesn't work because Google Analytics doesn't understand "&amp;" as an argument seperator.

     

    I need the "&" in the href to be rendered into the body of the email unencoded. 

  • PieterVeenstra Profile Picture
    13 on at

    Hi @steveshe,

     

    I tried sending an email with html and a href that included &s and it just worked. can you copy paste your email body (from the action) into notepad? This creates the exact detailed code and then DM it to me. 

  • steveshe Profile Picture
    Microsoft Employee on at

    I just sent it. I think it worked at one point but i can;t figure out what broke it or how to fix it. Let me know if you can see it.

  • steveshe Profile Picture
    Microsoft Employee on at

    I just remembed. I changed the email connector from Outlook.com to Office 365. I had apparently not been paying attention when I filtrered email actions on "Send an Email" and I accidentally selected the Outlook.com conenctor instead of Office 365. It worked, but it caused my flow to get suspended because we have a policy against connecting corporate BI to Outlook.com email. I redid the flow to use Office365 and I think it was after that when I noticed that the link was broken. 

     

    Which email connector are you using in your test?

  • PieterVeenstra Profile Picture
    13 on at

    FastCars.PNG 

    Here is my example. I went to google searched for fast cars. Then I copeid the url to my email body and replaced my query string with the variable. I'm getting an email with the right link in it.

  • steveshe Profile Picture
    Microsoft Employee on at

    I did it exactly as you did and i get this:

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
    </head>
    <body>
    <a href="https://www.google.com/search?q=fast&#43;carsFast Cars&amp;rlz=1C1CHBF_enUS731US731&amp;oq=fast&#43;carsFast Cars&amp;aqs=chrome..69i57j0l2j69i60j0l2.1875j0j8&amp;sourceid=chrome&amp;ie=UTF-8">click link</a>
    </body>
    </html>

     

    I am starting to think this a problem with Office 365 Mail... I will test with Outlook.

  • steveshe Profile Picture
    Microsoft Employee on at

    Same thing using an Outlook send mail task. I am stumped...

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
    </head>
    <body>
    <a href="https://www.google.com/search?q=fast&#43;carsQuery&times;&#8203;&amp;rlz=1C1CHBF_enUS731US731&amp;oq=fast&#43;carsQuery&times;&#8203;&amp;aqs=chrome..69i57j0l2j69i60j0l2.1875j0j8&amp;sourceid=chrome&amp;ie=UTF-8">click link</a>
    </body>
    </html>

  • v-yuazh-msft Profile Picture
    on at

    Hi @ steveshe,

     

    Are you still having this issue now?

     

    If you issue still exists, please share a screenshot of the configuration of your flow, so I could try to help you.

     

    As @ Pieter_Veenstra’s test, I have made a test on my side and don’t have the issue that you mentioned.

    The link with “&” always work well on both “Outlook.com” and “Office 365 Outlook” Connector.

     

     

    Regards,
    Alice Zhang

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard