This article explains about Dynamics 365 F&O Recurring Integrations. The procedure of data migration and movement into and out of any enterprise system, are critical pieces that any platform must support.
Lots of effort and planning go into building third-party integrations between an enterprise line of business (LOB) system, such as Microsoft Dynamics 365 for Finance and Operations and various source systems.
Microsoft Dynamics AX 2012 enables these scenarios through Application Integration Framework (AIF). For D365 Finance and Operations, the process is simplified for all parties who are involved, from integration solution builders to customer users.
Dynamics 365 F&O Recurring Integrations Overview
Integration does the following things:
- It builds on data entities and the Data management framework.
- It enables the exchange of documents or files between Finance and Operations and any third-party application or service.
- It supports several document formats, source mapping, Extensible Stylesheet Language Transformations (XSLT), and filters.
It uses secure REST application programming interfaces (APIs) and authorization mechanisms to receive data from and send data back to, integration systems.
2. Authorization for the Integration REST API
The Dynamics 365 F&O Recurring Integrations REST API uses the same OAuth 2.0 authentication model as the other service endpoints. Prior to the integrating client application consuming this endpoint, you must generate an application ID in Microsoft Azure Active Directory (Azure AD) and provide it with appropriate authorization to D365 Finance and Operations.
When you create and permit a recurring job, you are prompted to enter the Azure AD application ID that will interact with that recurring job. Therefore, be sure to make a note of the application ID.
3. Set up a Data Project and Recurring Data Jobs
Create a Data Project
- On the main dashboard, select the Data management tile to open the Data management workspace.
- Select the Import or Export tile to create a new data project.
- Enter a valid job name, data source, and entity name.
- Upload a data file for one or more entities. Make sure that each entity is added, and that no errors occur.
- Select Save.
Create a Recurring Data Job
- On the Data project page, select Create recurring data job.
- Enter a valid name and a description for the recurring data job.
- On the Set up authorization policy tab, enter the application ID that was generated for your application, and mark it as enabled.
- Expand Advanced options tab and define either the File or Data package.
- File – Your external integration will push individual files so that they can be processed via this recurring data job. In this case, the format of the file that is expected is similar as the format that was specified when the entity was added to the data project.
- Data package – You can send only data package files for processing. A data package is a new format that allows you to submit multiple data files as a single unit that can be used in integration jobs.
- Process messages in order – You can allow this option to force sequential processing of incoming files in an import scenario. This option is only relevant to the files and not data packages.
- Select Set processing recurrence and then, in the Define recurrence dialog box, set up a valid recurrence for your data job.
- Optional: Select Set monitoring recurrence and set up a monitoring recurrence.
Select OK and then select Yes in the confirmation message box.
4. Manage Recurring Data Jobs
- In the System administration workspace (not the System administration module), select the Data Management IT workspace.
- In the workspace, on the Recurring data job tab, select the recurring job to view the details. The Manage scheduled data jobs page consists of a grid that lists any messages that are waiting in the queue. Therefore, you can monitor messages and the processing status.
5. Submitting Data to Recurring Data Jobs
You can use integration REST endpoints to integrate with the client, submit documents (import), or poll available documents for download (export). These endpoints support OAuth.
6. Integration REST APIs
The following set of APIs is used to exchange data between the Dynamics 365 F&O Recurring Integrations client and Finance and Operations.
API for Import (enqueue)
Make an HTTP POST call against the following URL.
https://<base URL>/api/connector/enqueue/<activity ID>?entity=<entity name>
In the message body, you can the pass the data as a memory stream.
To get the activity ID, on the Manage scheduled data jobs page, in the ID field, copy the globally unique identifier (GUID).
API for Export (dequeue)
To return a data package that contains all the data entities that were defined in the data project, and that the client application can unzip and consume, use the following structure.
https://<base URL>/api/connector/dequeue/<activity ID>
After the client downloads the data, an acknowledgment must be sent back to Finance and Operations, so that you can mark the data as received. In cases when there was no file uploaded to the blob, the dequeue API will return a response indicating as such.
API for Acknowledgment
Use the following API.
https://<base URL>/api/connector/ack/<activity ID>
API for Getting Message Status
The API to get the status of a message is available as of hotfix KB 4058074 for Platform update 12. This API is particularly useful in import scenarios to decide if a message has been successfully processed.
A message is created when the enqueue process is completed. If the message returns a failed status, you can set your integration app to retry or take another action.
7. Tips and Tricks
Viewing the batch job status for Dynamics 365 F&O Recurring Integrations from the Data management workspace
Dynamics 365 F&O Recurring Integrations data jobs run in batch mode. If a recurring job crashes, you must investigate the instance of the batch job as part of the troubleshooting process. To make this investigation easier, choose Manage messages to get to the Process status for recurring data job page, which now displays the status of the batch job.
The batch job status is recovered asynchronously from the batch framework for the specified recurring data job. To see the most up-to-date batch job status, choose Get batch status and then refresh the page.
Preventing uploads when there are no records
When you use recurring exports in Finance and Operations, you can select not to upload a generated file or package if the total record count in that file or package is 0.
You can select the Prevent upload when zero records option either when you configure a recurring export job or after a job has been created. This option is available only when you use files or packages as data sources.
Http vs Https
The dequeue API returns HTTP instead of HTTPS. This behavior can be seen in MS Dynamics 356 Finance and Operations environments that use a load balancer, such as production environments.
It is recommended that you change the URI scheme to HTTPS in the middle ware application that is trying to dequeue from D365 Finance and Operations. For more information on Microsoft Dynamics 365 F&O Recurring Integrations, please contact us.