web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Dynamics 365 for Finance and Operations File Based Recurring Integration Using DMF and Logic Apps

Said Nikjou Profile Picture Said Nikjou 251

File based recurring integration is the most common way to make integrations between an ERP and other transactional systems.

Azure Logic Apps is a cloud service that helps you schedule, automate, and orchestrate tasks, business processes, and workflows when you need to integrate apps, data, systems, and services across enterprises or organizations.

In this typical business scenario for Dynamics 365FO  integrations, data will be exported to a downstream system on a recurring schedule. This blog post shows how to export a data package and save it to a OneDrive shared folder.

Scenario:

Contoso Entertainment System USA needs to provide a daily Expense report for all of its employees travel expenses to their Payroll service provider.

Create a New Export Job

In this step, you will be creating a new export job that can be used to export the Expenses entity:

  • Navigate to Workspaces > Data management.
  • Click on the Export
    pastedimage1590008743951v3.png
  • Fill out the Export details
    1. In the Group name field, type ExpensesExport.
    2. In the Description field, type Expenses export.
    3. Click Add entity, then type Expenses. For the Target data format, select CSV then click Add.
      pastedimage1590008743953v4.png

Create a new Logic Apps

  1. Sign into Azure portal

https://portal.azure.com

  1. Select Create a resource > Logic Apps > Create

pastedimage1590008755740v5.png

 pastedimage1590008768697v6.png

3. Select a Resource Group, write down a Logic App Name and click on Review+Create

pastedimage1590008810182v7.png

4. On the Logic App page select the Logic app designer option and then select Blank Logic App

pastedimage1590008842490v8.png

5. Search for Recurrenceand select the Trigger.

pastedimage1590008870656v9.png

6. Select the Interval and the Frequency. Add new parameter Time zone and at these hours

pastedimage1590008895792v10.png

7. Add a +New step and search for Initialize variable

pastedimage1590008918875v11.png

8. In this variable we will store the batch job execution ID

pastedimage1590008948785v12.png

9. Add a +New step and search for Until

pastedimage1590008974696v13.png

10. Before you add a value to control the loop, Add an action: 

pastedimage1590009001870v14.png

11. Search for Dynamics 365 for fin. In Actions select Execute action

pastedimage1590009028302v15.png

12. Sign in to create a connection to Dynamics 365 for Fin & Ops.

pastedimage1590009057266v16.png

13. Select your environment instance. In Action select DataManagementDefinitionGroups-ExportToPackage. This is the action that will execute the export Batch Job that we created earlier. Rename Execution action to ‘ExecuteBatchJob’

pastedimage1590009089702v17.png

14. Now you can add a value to control the loop. On ‘Choose a value’ text field and select OutputParameters is not equal to 00000000-0000-0000-0000-000000000000.

pastedimage1590009117481v18.png

15. Add few parameters.

  • definitionGroupId = ExpensesExport (this is the name of the export Batch Job created in D365FO.
  • executionID = Initialize variable BatchJobID
  • reExecute = No
  • legalEntityID = USMF (select the same legal entity where you created the export Batch Job).

pastedimage1590009156552v19.png

pastedimage1590009181036v20.png

16. Add an action and search for This delay is intended to allow D365FO to post the job results after it has finished.

pastedimage1590009208313v21.png

pastedimage1590009215096v22.png

17. Add a +New step and search for Condition

pastedimage1590009243317v23.png

18. Now define the condition. If value is-equal-to BatchJobID. The Value output parameters will contain the same execution ID that we provided while calling the execution action.

pastedimage1590009273361v24.png

19. The false condition indicates that the package can’t be exported. We will send an email with the message. Add an action and search for Send an email (V2):

pastedimage1590009297052v25.png

pastedimage1590009306469v26.png

20. Sign in with your Outlook credentials and include the email information:

pastedimage1590009324575v27.png

pastedimage1590009332606v28.png

21. Add an action for the True condition. Search for Dynamics 365 for fin. In Actions select Execute action.

pastedimage1590009350229v29.png

pastedimage1590009357035v30.png

22. In the Action field select DataManagementDefinitionGroups-GetExportedPackageUrl. Finally add a new parameter (executionId) and add the value of the ExecuteBatchJob

pastedimage1590009376222v31.png

pastedimage1590009383671v32.png

23. Add an action, search for HTTP, and select HTTP again in the Actions section 

pastedimage1590009400817v33.png

24. Set the Method to Get and URI as output value of the execute action added in step

pastedimage1590009421557v34.png

25. Add action to create a file on OneDrive. Look for OneDrive in the action search box. Select OneDrive and then select Create file action

pastedimage1590009451821v35.png

26.Sing in with your OneDrive credentials and provide the following information:

Folder path = /Integration

Create a new folder on your OneDrive

File Name = Expenses.zip

The zip extension is the default extensions of the data packages

File Content = Body

You need to provide the Body of the HTTP action form the earlier step.

pastedimage1590009485881v36.png

27. Add an action and search for Send an email (V2). Include the confirmation information about the Expense package.

pastedimage1590009516458v37.png

28. Save the Logic App. The Flow should look like this

pastedimage1590009553202v38.png

29. Run the Logic App

pastedimage1590009580454v39.png

30. Go back to the D365FO portal and review the Job history in the Data management workspace. A new export job with the name ExpensesExport should be executed 

pastedimage1590009601229v40.png

31.On the Azure portal, review if the Logic App executed successfully 

pastedimage1590009628160v41.png

32.Finally go to your OneDrive to find the Expenses.zip data package

pastedimage1590009656367v42.png

Comments

*This post is locked for comments