Dynamics 365 for Operations (AX7) Electronic Reports are used for statutory or country specific document purposes. The Microsoft repository contains a lot of document types out of box, but sometimes we need to create custom document. Let’s look at the scenario when we need to create electronic report for Sales Packing Slip.
There are two ways of running an Electronic Report:
- From the Electronic Reporting module, by selecting a configuration and running it.
- From a menu item, by linking a service to a proper Electronic Reporting configuration.
Both of these methods need a properly configured model and configuration and in this post we’ll discuss how to do this.
The Electronic Reporting module is located in the Organization administration –> Electronic reporting menu, or workspace. The first thing you should do is create a provider and set it as active.
You can configure an LCS repository if you want to store your reports online, and shared projects will automatically become available for everyone with access to the project where you store them.
Creating an Electronic Report model
Next, you need to create and configure a model. For this, go to Reporting configurations and select to create a new Root Configuration and go to Designer.
Here we create the model that from one side will be linked to the data from the system, and to template of the message/file that will be exported from the other. In the model, we create nodes with either the type of the field (String, Real, Date, etc.), or record/record list. The best way to create the model is to create similar structure with dependencies as in the system, i.e a separate node for transactions, another separate node for a transaction header, that has a link to transactions and a node that combines all root nodes.
Note: type “Record” can be filtered whilst “Record list” always returns all records.
After we create the model, we need to map it to the source of the data source. Press “Map model to datasource” and create a record, where its definition is your node from model that combines the data that you need (NOTE: one model can contain multiple root nodes, and multiple mappings, e.g. the standard Customer invoice model contains InvoiceCustomer and InvoiceProject mappings).
Now, proceed to designer. Here, on the left side we add a data source where we want to get data from and on the right side we map this to our model. So, in this case, we add “Table records” CustPackingSlipJour as a datasource and map that to the right node on our model.
Note: If you want to apply filters to records, you need to create “Table records” node and set the “Ask for query” flag.
Now we can bind fields and methods from this table to model nodes. To bind transactions, we shouldn’t create new data source, but as these records should be linked to Packing slip journal, we can get this from relations. Fields for that related table are bound in the same way, from relations.
Outbound message structure
So our model is finished and we want to create structure for the outbound message. To do this, we need to return to configuration screen, change status for the model to “Completed” and then click Create configurations -> Format based on data model.
Now open designer for the newly created format. As a root node you can select folder, file, xml and couple other fields. You also can import an xml file, and it will create the structure for you.
Note: If a node in your template doesn’t have value, it will not create an inner “String” node, and you will need to create it manually. If it does have value, it will be set as default value for created “String” node.
After creating structure, you should bind message nodes to nodes from model.
At this point you can run your configuration by selecting proper format and pressing run
One more thing you can configure – is destinations of export. This is only possible if your format contains the file node.
Microsoft has Electronic Reporting Overview article, but it’s far from a step-by-step tutorial. It was actually pretty hard to understand how everything works from it, as all the information is mixed up, there’s a lot of it and the UI is old in comparison to current version we have. So, hopefully, this saves your time, when you decide to work with ER.