This article outlines step-by-step how to generate and send a document using the DocumentsCorePack (DCP) connector for Microsoft Flow.
In this article, we are creating an on-demand flow that executes a DCP template and sends the result as an email in Dynamics 365.
1. Start by creating a new flow and selecting a trigger. In this example, we are building an instant cloud flow and selecting When a row is selected as the trigger.
2. Select Environment and Table Name. For the Table Name, select the entity(table) from which you want to start. In this example, we start from the entity(table): Accounts.
3. Click on + New step and search for the Add a new row action of the Microsoft Dataverse connector.
Select Email Messages as Table name and click on + New step again.
4. Search for the DocumentsCorePack connector and select Create Document Job (sync) from the list of actions.
5. After you select Create Document Job (sync), the corresponding window will pop up (Figure 5). Please fill out the following fields:
❶TemplateId: Select the DCP template that you want to use in the document job.
❷EntityId: Select a Dynamics 365 source record id.
❸FileType: Select HTML as the FileType.
Please Note: Make sure that the base entity of your template matches with the entity of your selected trigger.
6. Select + Next Step and look for the DocumentsCorePack connector. Then select the Attach DocumentJob to Email action. In order to use the result as an email, provide the following configuration:
❶ DocumentJobId: Please provide the ID of the previously created DocumentJob.
❷ Email Id: Enter the email where the document should be attached.
7. The last step will be the Send email action of the DocumentsCorePack connector.
8. Provide the email record, a sender, and a recipient before you save your flow.
Execute your Flow
You can directly start your flow within Dynamics 365 by pressing the Run flow button.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to firstname.lastname@example.org.