This article outlines step by step how to generate a document and save it to a Dynamics 365 record as a note attachment via Power Automate.
In the following description, we will create an automated cloud flow that creates a welcome letter. We start with the table Contact and the trigger is: When a new contact is added.
Step 1: Start by creating a new flow and selecting a trigger. In this example, we are building an Automated cloud flow and selecting When a row is added, modified, or deleted as the trigger.
Step 2: Select Change Type, Table Name and Scope. For the Table Name, select the table from which you want to start. In this example, we start from the table: Contact, and we select Added as a Change Type.
Step 3: Add a New step, search for the DocumentsCorePack connector, and select Create Document Job (sync)(V3) from the list of actions.
Step 4: After you select Create Document Job (sync)(V3), the corresponding window will pop up. Please fill out the following fields:
❶ Template: Choose a Template for this DocumentJob.
❷ Row ID: Unique identifier of the record to run this template for.
❸ FileType: Select a file type.
❹ Attach to Row: Enter the unique identifier of the record to attach this document to.
Please note: Make sure that the base entity of your template matches the entity of your selected trigger.
This is an alternative if you want to attach as note
Instead of attaching it in the Create Document Job (sync)(V3) (see Figure 3) step, you can add an extra step to the Flow:
Select + New Step and look for the DocumentsCorePack connector. Then select the Attach DocumentJob as a note action. To save the resulting note to the starting record, provide the following configuration:
❶ DocumentJob ID: DocumentJob to attach the note.
❷ Table name: Choose a table to attach the note.
❸ Row ID: ID of the record to attach the note to.
Please note: You can add a Note description or a Note subject for organizing your notes. Finally press Save.
Test your Flow
You can directly start your flow within Dynamics 365 by pressing the Test button.
After your flow runs successfully, the created document is attached to the new contact as a PDF.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to email@example.com.