Learn how to create Dynamics 365 Scheduled Report using Microsoft Flow. Microsoft released Flow about a year and a half ago, and it has seen significant upgrades since then. We can use flow to schedule a report and also include an HTML table in the email body.
Before we consider the solution, we might need to look at the platform that we are working on right now. Microsoft Business Application Platform, where Dynamics 365 plays an integral part in it, comes with Microsoft Flow that has numerous connectors available. This opens a very broad capability in building the business workflow.
Step 1: To set the schedule of the Flow
Step2: To filter Opportunity data Initialize variable.
To get the created on = Last 7 Days, we could use the Flow Built-In Formula/Expression:
Step 3: Next, we need to construct the filter for the Get List of Records from Dynamics 365 Fetch XML Query.
Step 4: Once we have the list record, we can use the Create HTML Table action on Flow to create the HTML table for the email body, as well as some field mapping.
Step 5: Before submitting the file, use the compose action to add CSS to the table to make it more appealing.
The table is now looking more appealing by using CSS.
Step 6: By producing HTML and converting the file to PDF, you can create and save PDF files using OneDrive operations:
Step 7: Typically, you could create a folder in OneDrive to store the report temporarily and do periodic clean-up. Then, put the content you want in the email body and attach it.
As a result, the following email with a PDF attachment is generated:
Step 8: The following report and PDF file are received in Outlook:
PDF file is opened with PDF reader as below:
Step 9: This is what the final flow looks like: