D365 Finance & Operations and Dynamics AX Forum

Vendor Invoice Automation and Excel's query "from OData Feed" to access and update data entities - Part 2

By Shilpi Thakur posted Jun 18, 2020 03:19 AM


In the last blog post, we looked at the AP automation framework used in Dynamics 365 F&O to import vendor invoices and how we can use the OData feed to see how an interaction's messages are constructed. Test the response of service to a well-known request and determine how exceptions occur at other endpoints.

In this post, let's explore this concept a bit more and look at the recurring integration framework and steps to register an Azure application and steps to set up the Recurring Integration Manager for integration with D365 F&O to run the automated vendor invoice import process.

1. Prerequisites

  • Working data management import project, configured, and working through manual import for vendor invoices.
  • Access to the Azure portal.
  • Recurring Integration manager installed on your local machine.
    • Note: The Integration Manager works with the Data Management entities to import files on the backend through an automation process.

1.1 Data Package

Create a data package to import using the AP Automation framework – not individual files, so as discussed in the previous post submit the data package to the service endpoint [ Recurring data Manager in this case]/ A data package will have a Manifest.xml file, PackageHeader.xml file and data files for Vendor Invoice Header, Vendor Invoice Lines and Vendor Invoice Document Attachments.

The following screenshot shows the data package

1.3 Data Management Import data project and recurring data job

Create an import project in the Data management workspace in D365 F&O. The following screenshot shows the import job that I will use to import vendor invoices.

The next step is to set up the job recurrence. Click on the 'Create recurring data job' in the ribbon of the import job created in data management. This defines how often the system should process messages through the inbound message queue.



1.2 Recurring Integration Manager

Download and do a full install of the Recurring Integration Manager software from GitHub from the following link. The documentation is available on the wiki page.

Once installed, you will need to log into Azure Portal and carry out a few steps. You might need to work with your Azure System Administrator for this.

1.3 Azure Applications registration

Step 1: Login into the Azure portal. Open the Azure Active Directory and within the App registrations menu, create a new application.

Name - D365 Test API

Open the application and note the following:

Application ID and Object ID as in the below screenshot

  • Application ID
    • 393eb0e1-fb46-4325-****-************
  • Object ID
    • a956786eb-bf4c-477e-****-************



Step 2: The next step is creating a secret key in the Azure Active Directory for the registered App. Click on Certificates and secrets and then under Client secrets create a new secret key.


Save and note down the value of the secret key. Once this page is closed, you cannot see this value again.

Step 3: Now go into the D365 and navigate to System administration > Setup >Azure Active Directory applications. Click New and then paste the Client ID in with an identifier name and a user to execute this. The client ID is available from the Azure Active Directory/Application ID we copied in Step 1.


Step 4: Next, go into the Data Management and complete the final steps for configuring the import project.

Click on the 'Manage' tab then click on 'Manage recurring data jobs.'

Some essential settings listed as below:

  • Set monitoring recurrence – Setup the recurrence of the job
  • ID - Client ID used to bind the enqueue HTTP call to the recurring job.
  • Application ID – The registered application ID for D365 F&O in system administration.
  • Process messages in order – Must be set to Yes to ensure headers get processed before the lines and attachments
  • Supported data source type – Must be setup to Data Package to enable the import of data packages.


1.4 Configure the Recurring Integration Scheduler

Step 1: Open the installed Recurring Integration Scheduler from your local machine and click Parameters, in D365 F&O instances and click Add


Enter the following:

  • Friendly name
  • AOS URL [URL of the D365 F&O instance]
  • Auth endpoint [from the registered Azure App]
  • Tenant value

Step 2: Next, Validate the settings by selecting the Dynamics 365 instance, and then click Validate image, selecting the Service authentication option along with the AAD client App of the service.


Step 3:
  Next, click on the Add in the Azure AD applications section.
Enter the following:

  • Friendly name
  • Client ID
  • Client secret [The secret key generated in registered Azure application - Section 1.3 - Step 2]
  •  Authentication type - Service

Step 4: Next, set up the Data job by selecting 'Add' and then entering the friendly name with the Activity ID, which can is available on the Manage schedule data job in the D365 F&O instance.

Step 5: Create the upload or import job details and connection setup and save the setup.


Step 6: The final step is to drop the import file into the Input directory, and it will automatically get processed at the scheduled time and moved into the UploadSuccess folder.


On the Process monitoring job schedule, the import will get processed and will move into the Processing Success folder if there are no errors (the time is set to 1 minute in the above image).


2. Monitoring Messages in D365 F&O

In D365F&O, when I go to the recurring job and click on Manage messages in the ribbon, I can see the messages put on the queue by the flow. In the following screenshot you can see that at the top of the list, I have a queued message ready for processing after I invoked the scheduler.


3. Import results

Go into the Pending vendor invoices screen form and open the automated created.

Open the pending vendor invoice to see the header, line details, and side by side view of the vendor invoice attachment.


4. Conclusion 

What we just saw and discussed is the use of one of the third-party utilities that support the REST API and authorisation mechanism. You can use other available third party utilities that support the REST API and authorisation mechanism to receive data from and send back to integration systems.

Other Links



I hope the two posts have helped you understand the vendor invoice framework and integration with third-party utilities. Please feel free to reach out to find any additional questions or drop your questions, suggestions, or feedback in the comments box below.