In this Power Automate tutorial, we will see how to fix the Code View hyperlink is being rewritten when using the link to item in Send an email (v2) action dynamic content in Power Automate.
Scenario:
I want to send an email reminder from the SharePoint list along with the link to the item. So whenever using Send an email (v2) and viewing in Code View, I add a Dynamic field to the content (i.e. a hyperlink a href=”<dynamic field>”) like below: The very first time it works fine and later it changes automatically to an object and sends an email with the object.
For example: Code View is highlighted below:
<a href='@{items('Apply_to_each_2')?['{Link}']}'>click here</a>
But when I change the code view back to HTML View it changes the whole email body as highlighted below:
Changed into this:
<a href="<object custom="LOGICAPP">@{items('Apply_to_each_2')?['{Link}']}</object>">click here</a>
I solved this problem by initializing a variable, To overcome this issue, Follow the below steps. I’m confident that it will also work for you.
Code View hyperlink rewritten: Send an email (V2) action Dynamic Content in Power Automate
Let us see how to fix the code View hyperlink rewritten in Send an email (V2) action Dynamic Content using Power Automate Flow.
Step-1:
Here, I’m going to use the below SharePoint Online TaskList consisting of,
- TaskName – default title column
- AssignedTo – Person or Group type
- TaskPriority – Choice type
- TaskStatus – Choice type
- DueDate – Date and Time type
Step-2:
- Log in to Power Automate flow using the credentials, and select +Create -> Scheduled cloud flow.
- Enter the flow name choose the Starting Date, Time, and Repeat frequency, and click on the create option. I want to run the flow every day so I have selected every 1 day.
Step-3:
Add a new step and select Get items action from action triggers. Configure the SharePoint site Address and List Name to retrieve all the items from the SharePoint list.
Step-4:
Select the initialize variable action from the action triggers, later we will use it in our flow. Enter the variable name, and choose the variable type as String.
Step-5:
Add a new step and select Apply to each control and select the output from the previous steps, pass the values from dynamic content.
- Now we will add a condition to check if the date values presented in the SharePoint list are equal to Today’s date value.
items('Apply_to_each')?['DueDate']
utcNow()
- If Yes then we will send an email to notify the assigned users, we will add an apply to each control and Pass the Assigned To the dynamic content value to get the dynamic content value of the Display name of assigned users.
- Select the set variable action and generate a dynamic URL to send an email with the assigned task item.
- In the Name field, select the initialized variable from the dropdown. In the value section, pass the below value.
<a href='@{items('Apply_to_each')?['{Link}']}'>click here</a>
Add a Send an email(V2) action and Pass the To as AssignedTo Email, Subject, and Body from Dynamic content values.
Step-6:
The Scheduled Flow Runs based on the Scheduled date and time and Repeat frequency. My Current Date is (25/08/2023). My Flow rans at 5:30 PM.
Below displayed is my SharePoint list 2nd item-assigned users will get a reminder for the Due date Today.
The assigned users will get an email in Outlook with the generated dynamic link as highlighted below:
By initializing a variable we can fix the code View hyperlink rewritten in Send an email (V2) action Dynamic Content using Power Automate Flow.
Conclusion
In this Power Automate tutorial, we saw how to fix the Code View hyperlink is being rewritten when using the link to the item in Send an email (v2) action dynamic content in Power Automate flow.
You may like the following Power Automate tutorials:
- Power Automate Send 7 or 14 Day Task Due Reminder Emails
- Create Hyperlink Dynamic Content in Power Automate
- Check if an item exists in a SharePoint list using Power Automate
- How to Convert time zone in Power Automate?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.