Home / News / Online Invoicing with EM/ER
13 January 2022
By: Simon van Dijk

Online Invoicing with EM/ER

What is online invoicing?

What exactly is Online Invoicing, also known as Electronic Invoicing or e-Invoicing, and how can you apply it for your customers in Dynamics 365 for Finance and Supply Chain Management? Online invoicing is nothing more than electronically processing digital invoices in an accounting system from an automated system, in our case D365FSCM. To handle online invoicing in D365FSCM, we have available two types of functionalities which work closely together: Electronic Messaging (EM) and Electronic Reporting (ER). In this blog, I will tell you more about all of this and describe a scenario we have been implementing for one of our international customers.


Electronic Messaging

Recently, the governments and legislative authorities of various countries around the world have implemented reporting requirements for companies that are registered in those countries. The purpose of the requirements is to enable data to be obtained from those companies in an electronic format, directly from the systems where it was accounted, stored, and processed.

Well, the EM functionality in D365FSCM is designed to provide this kind of electronic interoperability between D365FSCM and the systems that governments and legislative authorities offer for reporting, submitting, and receiving official information.

Some basic concepts in this EM functionality are:


  • Electronic message: a report or declaration to be transmitted, such as a report that is sent to a tax office.
  • Electronic message items: records that should be included in the reported message.
  • Electronic message processing:a chain of linked or unlinked actions that should be run to collect the required data, generate reports, store data in Azure Blob storage, transmit reports outside the system, receive responses from outside the system and update the database based on the information that is received.

The following illustration shows the data flow for EM:

Electronic Reporting

The EM functionality is tightly integrated with the ER module, which you can use to configure formats for the electronic messages in accordance with the legal requirements of the various countries. ER is considered to be the primary standard tool to support localization and lets you manage these formats during their life cycle. As requirement changes by government bodies can occur regularly, this means that in those cases the electronic message formats have to be updated accordingly.

Instead of extending the code for D365FSCM to meet regulatory features and compliance for different countries, any business user can simply configure and use this ER tool without a single line of code. Although… this is what Microsoft claims, and as usual things are a little bit more complicated than that. The help of a functional consultant and a developer is almost always needed to get it all working!


Online Invoicing processing

So, how is EM/ER applied for online invoicing processing? Take a look at the actions in the following schema:

The EM functionality supports the following scenarios for the online invoicing process:


  • Collect and process information from a data source (a D365FSCM table) as message items.
  • Store additional information and evaluate various values by calling specifically defined executable classes in relation to messages and message items.
  • Aggregate information that is collected in message items, split that information by message, and generate reports that are in associated ER formats.
  • Transmit the reports that are generated to a web service by using security information that is stored in the Azure key vault.
  • Receive a response from a web service, interpret the response, and update data in D365FSCM as appropriate.
  • Store and review all the reports that are generated.
  • Store and review all the log information that is related to actions that are run for a message or message item (stored as attachments linked to these messages and message items).
  • Control the processing through various message statuses and message item statuses.

OK, now that we have some general background information, let’s talk about our specific customer scenario. One of our international customer’s locations is Hungary…


NAV Online Invoice System

“Navision?”, I hear you think for a split second… No worries, NAV is the name of the Hungarian tax authority: Nemzeti Adó- és Vámhivatal. My Hungarian is a bit rusty so I will just stick to: National Tax and Customs Administration. This NAV has determined that from July 1st, 2018, companies in Hungary are required to supply data of their issued invoices to the “Real-Time Invoice Reporting” (RTIR) platform of the online invoicing system.

This concerns an online data disclosure of the data of the invoices containing value-added tax of at least 100.000 HUF (which is about 280 EUR at this moment). The taxpayer is obliged to provide the tax authority with data on invoices and invoice-equivalent documents issued for the provision of goods and services performed by the taxpayer. For this purpose, the National Tax and Customs Administration has provided an electronic platform, the “NAV Online Invoice System”.


Real-Time Invoice Reporting setup in D365FSCM

To get the online invoicing working in a Hungarian legal entity in D365FSCM, we had to set up ER configurations and configure electronic messaging functionality for RTIR. The following tasks had to be completed:


  • Import the most recent versions of the needed ER configurations (Invoices Communication Model, Electronic Messages framework model, RTIR model mappings and RTIL-related XML formats) and set up application-specific parameters.
  • Set up EM functionality by importing a package of data entities that includes a predefined EM setup.
  • Set up all parameters to make the EM functionality ready to use for RTIR.
  • Test the RTIR process by automatically running actions that are included in the processing, based on the status of messages and message items. To do this, we could use the available NAV test websites and web services.

Note that we had to overcome some challenges to get things working in D365FSCM. It was an interesting matter of:


  • Trial and error,
  • Debugging and analyzing the technical error information in the XML of the response messages received from the webservice,
  • Creating a derived version of the “RTIR mapping” configuration to fix a few bugs,
  • Adjusting application-specific parameters of the “RTIR Invoice Data (HU)” format configuration,
  • Fine-tuning finance setup, etc.



In the end, we were able to successfully help our customer to establish local electronic tax compliance. It was a great experience to see how D365FSCM with EM/ER supports a country-specific regulatory feature, to implement a technological solution allowing automated and electronical communication with tax authorities: Online Invoicing in action!