Email in Power Automate - HTML Links with Dynamic Variables
Ron Schindler – Sovereign SP
What are we trying to accomplish?
When sending an email with an automated flow, there are many times that you wish to link the recipient back to a specific page. Sometimes this page may have different views, permission levels, or query parts that need to be dynamically built as the link is made. That is a little more difficult for the built-in link icon in the email send action in Power Automate.
This paper will show you how to use the built-in link but also how to use variables and apply them to a link in an email. Using variables can help you to put in your dynamic content needed for more complex links.
Below is a simple send email action with the recipient, subject, and message filled in. The green items are the dynamic content that we can add anywhere we need to.
If we wanted to add a link, on the text “task list” we can simply click on the link icon in the email ribbon.
By highlighting the text and then clicking on the link icon, the Link Title is already filled in for us but you could change this to whatever you need the hyperlink words to say.
Next step is to fill in the Link Target. Notice that we can only put in text here and are not allowed to add dynamic content from our list.
After we have changed the Link Title and assigned a URL, we click the Add button.
Notice the blue hyperlink text “My Task List”.
Adding the dynamic links
Dynamic content can be added in two places when we make links. The first place is to create a variable with the “Initialize Variable” action. I am naming my variable “Task Link”. Within this, I can set a value for the variable and that content can include my dynamic content like below. If we want to create our own link, we just add the <a href=” “> to start our link. In between the quotes we would put our URL's and our variables. We then put the text or dynamic content that creates the textual link in the email to create the word "HERE" with the magic link. Make sure to include the </a> closing tag for our html.
Once we have initialized our variable, we return to our email and enter the variable anywhere we would like the link to happen.
This is where I want my new dynamic link, so I will replace the word "HERE" with the dynamic content which will be my variable.
Now we add our variable in place of "HERE" from the dynamic content menu. Which looks like this.
Instead of the word “HERE”, you now see the variable and behind that variable, is the html code that looks like this:
The Results
The resulting email looks like this.
When I hover over our simple link, you see the results of exactly what I typed into the simple link pop-up.
When we hover over the link that included my dynamic content bundled into the variable, you see the information from the most current item's ID and Project number embedded into the link.
In Conclusion
This was a simple example of how dynamic content can be used to create links in an email from Power Automate. Continue to build on the ideas from this paper. Consider trying more than one variable and combining them. You might be able to link to dynamically created image or document names that were created and stored. You may be able to create email templates with this method to be copied to your clipboard and used over and over. The possibilities are endless.
Our Training and Services
Power Apps you can buy and modify -
Online Courses
"I am so glad that I purchased your course. I like your teaching style and find it easy to learn." - Ray from Canada
Services
Ron Schindler – Sovereign SP
Ron is an experienced professional with in-depth expertise in SharePoint, corporate presentations, training, change management, communications, marketing, and facilitation. Ron brings this experience together to design SharePoint solutions that meet our clients business, training, and collaboration needs. Skill set includes: Program Management, Change Management, SharePoint Site Administration and Architecture, Project Management, Graphic Design, and Technology Infrastructure Expertise. Ron is an expert skier and speaks Japanese as a second language.