This article provides a step-by-step guide on how to generate a document, attach it as a note, and save it to SharePoint using Power Automate.
In the following example, we will create an automated cloud flow that generates a welcome letter, attaches it to a contact after the contact has been created, and saves it to SharePoint using Power Automate.
Prerequisites: To use the DocumentsCorePack Connector, you will need to get an API key from the service configuration. Learn more about how this works here.
Step 1: Creating the flow
Begin by creating a new flow and selecting a trigger. In our case, we will build an automated cloud flow. We will select When a row is added, modified, or deleted as the trigger.
Step 2: Setting our starting parameters
Fill in the parameters accordingly. We will set Change Type to Added and set the Table Name to Contacts.
Step 3: Adding our action
Next, we will add a new action to our flow. Search for the DocumentsCorePack Connector and select Create document (sync) (V3) from the list of actions.
Step 4: Configuring our action
After selecting the action, the following window will pop up. Please fill out the following fields:
❶ Body/Template: Choose a template
❷ Row ID: Select the unique identifier of the record to run this template for
❸ FileType: Select a file type
❹ Save To SharePoint: Choose whether or not to save the generated document to SharePoint. The document will be stored in the document location of the record the document is created for.
❺ Attach to [Row ID]: The unique identifier of the record to attach this document to.
❻ Attach to [Table]: The table the generated document should be attached to
❼ Body/Environment: The environment this action should be used in
Please note: Make sure that the base entity of your template matches the entity of your selected trigger.
Fill out our action as shown below.
Optional Step: An alternative approach
Instead of using the Create document step to attach the generated document to the record, it is also possible to add an extra step to the flow and attach it there.
Add the Attach DocumentJob as a note (V3) action after the Create document action. You can configured the following parameters:
❶ DocumentJob ID: The DocumentJob ID of the generated document
❷ Table name: Choose a table to attach the note to
❸ Row ID: ID of the record to attach the note to
Please note: You can also add a note description or a note subject to help organize your notes.
Fill in this action as follows:
Set up your flow, then save it.
Step 5: Testing the Flow
You can directly start your flow within Dynamics 365 by pressing the Test button.
After your flow runs successfully, it attaches the created document to the new contact as a PDF.
If you configure the Create document action to save the document to SharePoint, you will find the document under the Documents tab of the record.
Back to “The DocumentsCorePack connector for PowerApps and PowerAutomate (Microsoft Flow)“.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to support@mscrm-addons.com.