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.
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. Then search for the DocumentsCorePack connector and select Create Document Job (sync) from the list of actions.
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.
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.
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.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to firstname.lastname@example.org.