This article outlines step by step how to generate a document and save it to a Dynamics 365 record with Microsoft Flow.
In the following description, we will create an on-demand flow that executes a DCP template and saves the result to our starting record (Account) in Dynamics 365.
Steps:
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.
Figure 2: Select Environment and Table name
3. Click on + New Step. Then search for the DocumentsCorePack connector and select Create Document Job (sync) from the list of actions.
Figure 3: select the connector and click on an action
4. 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 this document job.
❷EntityId: Select a Dynamics 365 source record id.
❸FileType: Select a Filetype.
Please note: Make sure that the base entity of your template matches the entity of your selected trigger.
Figure 4: Create Document Job (sync)
5. Select + Next Step and look for the DocumentsCorePack connector. Then select the Attach DocumentJob as note action. In order to save the resulting note to the starting record, provide the following configuration:
❶DocumentJobId: Select the previously created DocumentJobId.
❷Entity Id: Enter the ID field of the record, where the document should be attached to.
❸Schemaname: Select the matching entity to your record.
You can add a Note description or a Note subject for organizing your notes. Finally, press Save.
Figure 5: Fill out mandatory fields
Execute your Flow
You can directly start your flow within Dynamics 365 by pressing the Run flow button.
After your flow has run successfully, you can see the created document in the timeline.
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.