Microsoft Dynamics 365 has powerful reporting features using which reports can be generated easily. But, the most important thing is to schedule the delivery of these reports to respective recipients for which there is no solution readily available. However, by using MS Flow and custom solution this requirement can be achieved.
Below are the detailed steps how MTC solution experts have gone about to achieve this.
Installing and configuring Report Scheduler
Use link to download Report Scheduler Solution -
1. Go to Settings > Solutions, click import
2. Choose the solution file and click Next. Follow the prompts until the importing process begins.
3. After the solution is imported, open it up. You will be directed to the Settings page.
4. Enter Username and Password (Same as your CRM credentials).
5. Click Submit. You will see an alert that says, “updated successfully.”
Application Registration in Azure AD
1. Open Azure AD
2. From the left-hand side navigation menu, go to Azure Active Directory > App registrations.
3. Click New registration.
4. Enter the Name and click Register (Note: Redirect URL can be added at a later stage).
5. After successful registration, you will notice the below page with details such as Display name, Application (Client) ID, Directory (tenant) ID, Object ID, Supported account types, Redirect URLs, Managed application in local directory.
6. Go back to Home > Schedule Reports – Certificates & secrets.
7. Create New client secret.
Note: Keep this client secret handy for using in MS Flow.
8. Create API Permission for scheduling the report (refer below image).
Creating Connector in MS Flow
1. Download Report Render Swagger json file from Releases
2. Create the connector by importing the OpenAPI file.
You will be directed to the following “Create a custom connector” box.
Enter the connector name and import the json file that you’ve just downloaded from Releases.
Click Continue and go through the steps – General, Security, Definition and Test.
General – You can upload icon if any and set icon background color.
Security – Select the Authentication type from the dropdown, enter Client Id and Client Secret, (both of which were created during the Application Registration in Azure AD), provide Resource URL and then click Create Connector.
You will notice a Redirect URL is automatically created. Copy this URL and add it to Azure AD under Authentication.
Definition: Complete General, Request, Response and Validation.
Test: Under Connections click “+New connection” and add the connection. Then click “Test operation.”
Steps for Scheduling of Report Delivery using MS Flow
Go to My Flows. Click on “+New” and select “+Instant - from blank” option from dropdown.
A window box prompt appears. Enter the flow name and choose how to trigger this flow.
You will notice that Recurrence step is created. Click on +New step to build the flow.
Choose an action window pops up. In the look up field, enter the keyword renderer to select and pick the Report renderer file.
The following window appears on selection.
Select Report (such as Account Summary, Invoice, Invoice Status, etc.) and Format (PDF, JPG, JPEG, etc.) from the drop down and click Save.
Click +New step. From the look up field, enter the keyword send an email to select and pick Office 365 Outlook.
Enter fields such as To, Subject, Body, Attachments, etc., and click Save.
The flow will be successfully saved.
On the top right side of the ribbon, you will notice Save, Flow Checker and Test options.
Click Save and then Test.
From the side pane, select the radio button “I’ll perform the trigger action” under Test Flow.
A run flow window pops up. Click Run Flow.
You flow runs successfully and will get the notification if no error occurs. In case of errors, see the error message and fix the errors to run the flow again.
Go to Outlook and check if the Invoice PDF is generated by flow and sent as email.
Likewise, you can schedule delivery of reports in Dynamics 365 using Microsoft Flow for other entities too.
Write to email@example.com if you have any queries or need technical assistance.