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

Community site session details

Session Id :

Import AP Invoices into Dynamics 365 for Finance and Operations

Henrik Larsen Profile Picture Henrik Larsen 646

Recently, Microsoft announced improvements in AP automation for Dynamics 365 for Finance and Operations (D365FO). More specifically, they provided a framework for importing invoices into the pending invoices tables.

You can read more about the framework here.

Basically, the framework consists of three data entities, namely:

  • Vendor invoice header.
  • Vendor invoice line.
  • Vendor invoice document attachment.

What each data entity does, is pretty self-explanatory.

The import framework is simply managed through the Data management workspace.

To try out the framework, I firstly created an export project in order to provide empty spreadsheets in the correct format for the import. This is a simple way of providing import templates in the correct format.

AP 1.PNG

As you can see from the above example, I elected not to import invoice lines.

It is important to note that the invoice image (document attachment) is linked to the invoice header. It is currently not possible to link images to invoice lines.

As the example also shows, I am using Excel spreadsheets for the invoice meta-data. I could obviously have used any other available format such as CSV or XML, which makes the framework pretty flexible.

It is also important to note that since the document attachment contains a binary file (the image) the import must be made through a data package.

Next thing I did was to download the project (data package) from the menu ribbon. This creates a package structure that can be saved to disk. Please note that this is a .ZIP file.

The file structure created can be seen in the following example:

AP 2.PNG

If I open the Vendor invoice header file, as shown below, it contains all the headings from the data entity.

AP 3.PNG

The user can now use this template to fill in the fields necessary to import the invoice.

Important fields that should be filled in are:

  • HeaderReference.
  • Currency.
  • Date.
  • InvoiceAccount.
  • InvoiceDate.
  • InvoiceId.
  • InvoiceNumber.
  • IsApproved (Set to No).
  • VendorAccount.

The HeaderReference is important. It should be a unique value generated by the source system. The same value should be used in the invoice document attachment and invoice line files to link lines and attachments to the header.

The important fields in the document attachment file are:

  • DocumentId (must be a GUID generated by the source system).
  • DefaultAttachment (must be set to Yes to automatically display the invoice image side-by-side with the invoice meta data).
  • FileName (without extension).
  • FileType (file extension).
  • HeaderReference (see above).
  • TypeId (set to Image).
  • FileContentsFileName (full name of the file without path).

Now, the important question is: where do I put the invoice image.

To do this, you need to create a sub folder called Resources within the structure as shown below.

AP 4.PNG

Within the Resources folder another sub folder called Vendor invoice document attachment must be created. This sub folder should contain the invoice image itself.

In my example I use an image called HML.png.

So the path will be ..\Resources\Vendor invoice document attachment\HML.png.

Now, all we need to do it select all the files and zip them as shown below:

AP 5

In a real-world solution the source system should automatically zip the files after generating them.

Now we go back into the Data management workspace to create an import project.

In this case, I configure the entities in the project simply by selecting Add file in the project lines ans selecting the .ZIP file we created above as shown below.

AP 6.PNG

This automatically configures the entity lines based on the manifest in the data package as this picture shows.

AP 7.PNG

Now we are all set and I click the Import button in the ribbon to start the invoice import.

As expected, the import job contains two data entities that import successfully as shown here.

AP 8.PNG

When we go to the Pending supplier invoices screen in the Purchase ledger module, you can see that it now contains the invoice in the list.

AP 9.PNG

When I click on the invoice, I see the invoice meta data side-by-side with the invoice image.

AP 10.PNG

Apart from the dodgy invoice image (of a younger me) in this example, what’s not to like?

 

 


This was originally posted here.

Comments

*This post is locked for comments