How to use dynamic email template in Power Automate How to use dynamic email template in Power Automate
Prutha Patel

Prutha Patel

June 11, 2024

All Post
How to Use Dynamic Email Template in Power Automate
Share:

SharePoint is a strong tool for teamwork, with many features to help teams work efficiently. One useful feature is creating templates that automatically get content from lists, which helps users avoid doing the same tasks over and over. 

In this blog post, we’ll show you how to make a template in SharePoint that pulls content from a list and sends it out by email using Power Automate. This integration between SharePoint and Power Automate can save you time and resources while making sure the right people get the important information quickly. 

In the SharePoint list, we create two lists. The first list is named “Email Template.” In this list, we create a column called “Template,” which is a multiple lines of text column. We add an email template to the “Template” column by creating a new entry in this list. 

Additionally, we create a template where we retrieve four values from another list: “Purchaser Name,” “Delivery Date,” “Product Name,” and “Purchaser Name.” 

 

The second list is named “Online Order Product Details,” where we create a “Delivery Date” column as Date and Time. Additionally, we have a “Product Name” column, which is a choice column, and we include the default “Created By” column provided by SharePoint. 

In the template, we replace “Purchaser Name” with the name of the creator, retrieved from the “Created By” column in the list. The “Delivery Date” is substituted with the dynamic value from the “Delivery Date” column in the “Online Order Product Details” list. Similarly, the “Product Name” column is replaced with the dynamic value from the “Product Name” field in the “Online Order Product Details” list.

Step:1 Add the “When an item is created” trigger action and specify the site URL and list name from which dynamic values are retrieved. The flow will be triggered when an item is created or modified in the SharePoint list. 

 

Step:2 Add the “Get Items” action, specifying the site address and list name where the user creates the template in the list. 

 

Step:3 Add the compose action and create the expression to first replace the Purchaser name with the Created By display name. 

Add the following expression in the compose action: 

First, add the “Replace” value. Then, include the “Get Items” action to retrieve the value. Here, obtain the data at index “0” to retrieve the number 1 ID. Next, specify the column name where we create the template in multiple lines of text. Add a comma after this, and then include the dynamic name you wish to use to replace the original data. Add a comma after the dynamic name. Finally, include the “Created By” display name, which retrieves data from another list. 

replace(outputs(‘Get_items_-_Email_Template)?[‘body/value’][0][‘Template’],'[Purchaser Name]’,triggerOutputs()?[‘body/Author/DisplayName’]) 

 

Step:4 Add a new “Compose” action. Use the “Replace()” expression. Insert the compose output from dynamic content inside the brackets. Specify the name to replace the delivery date. Add the delivery date value. 

replace(outputs(‘Compose_-_Replace_the_Purchaser_name‘),'[Deliver Date]‘,triggerOutputs()?[‘body/DeliveryDate‘])

 

Step:5 Add a new “Compose” action. Use the “Replace()” expression. Insert the compose output from dynamic content inside the brackets. Specify the name to replace the Product Name. Add the Product Name value. 

replace(outputs(‘Compose_-_Replace_with_the_Delivery_date‘),'[Product name]‘,triggerOutputs()?[‘body/ProductName/Value’]) 

 

Step:6  Add a new “Compose” action. Use the “Replace()” expression. Insert the compose output from dynamic content inside the brackets. Specify the name to replace the Purchaser Name. Add the Created by display name value. 

replace(outputs(‘Compose_-_Replace_with_the_Product_Name‘),'[Purchaser Name]‘,triggerOutputs()?[‘body/Author/DisplayName’]) 

 

Step:7 Add the “Send an email” action. Fill in the required fields. Add the last compose output to the email body. Save and test the flow. Show the output. Users can change the template in the list without manually updating Power Automate each time. 

 

Step:8 Users can add other dynamic values in SharePoint and compose actions step by step. Save and run the flow to see the email output.

 

Conclusion: By establishing a SharePoint template to extract dynamic content from a list and automating email distribution through Power Automate, businesses boost efficiency and productivity. This integration saves time, ensuring data accuracy and consistency. As organizations strive for workflow optimization, SharePoint and Power Automate provide a robust framework. This solution caters to reporting, notifications, and communication, offering flexibility and scalability for managing information flow within teams and across departments. 

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk?

Drop us a line. We are here to answer your questions 24*7.