In one of our recent projects, we had a requirement from a client to attach a Word template to a Note entity as a PDF. We accomplished this using Power Automate. Here's a step-by-step guide to help you achieve the same:
Step 1: Create and Prepare the Word Template
Create the Word Template: Open Microsoft Word and create a template. Instead of using XML mapping, add controls using the Developer options and properly name each control. For example, you might add controls for Name, Email, and Phone.
Step 2: Set Up the Trigger in Dynamics 365
Create an Option Set Field: In the Account entity, create an option set field with two options: Yes and No. This field will trigger the Power Automate flow when its value changes.
Step 3: Configure Power Automate
Populate the Word Template:
Use the "Populate a Microsoft Word template" action in Power Automate.Select the Word template from OneDrive. The action will display the controls (e.g., Name, Email, Phone) you added to the template.Map the appropriate Dynamics 365 fields to these controls.
Create a File on OneDrive:
Add the "Create file" action.Set the Folder Path to the desired location in OneDrive.Specify the File Name and add the body content from the "Populate a Microsoft Word template" action as the File Content.
Step 4: Convert to PDF
Now we will convert our file to PDF using "Convert Word Document to PDF" action.
Step 5: Convert PDF to Base64
Add a "Compose" action.
Use the following expression to convert the PDF file to Base64:
base64(outputs('Convert_Word_Document_to_PDF')?['body'])
Use the "Create a new record" action to create a Note entity record.Attach the Base64-encoded PDF to this Note.
Step 1: Create and Prepare the Word Template
Create the Word Template: Open Microsoft Word and create a template. Instead of using XML mapping, add controls using the Developer options and properly name each control. For example, you might add controls for Name, Email, and Phone.
Step 2: Set Up the Trigger in Dynamics 365
Create an Option Set Field: In the Account entity, create an option set field with two options: Yes and No. This field will trigger the Power Automate flow when its value changes.
Step 3: Configure Power Automate
Populate the Word Template:
Use the "Populate a Microsoft Word template" action in Power Automate.
Select the Word template from OneDrive. The action will display the controls (e.g., Name, Email, Phone) you added to the template.
Map the appropriate Dynamics 365 fields to these controls.
Create a File on OneDrive:
Add the "Create file" action.
Set the Folder Path to the desired location in OneDrive.
Specify the File Name and add the body content from the "Populate a Microsoft Word template" action as the File Content.
Step 5: Convert PDF to Base64
Add a "Compose" action.
Use the following expression to convert the PDF file to Base64:
base64(outputs('Convert_Word_Document_to_PDF')?['body'])
Use the "Create a new record" action to create a Note entity record.
Attach the Base64-encoded PDF to this Note.








