Do you remember when, a year and a half ago, at NAV Tech Days, you gave us feedback on the NAV Design Patterns session – saying that Journal Error Processing is not generic and decoupled enough?
Well, my colleagues Andreas Moth and Jesper Schulz from the NAV localization team at Microsoft Development Center Copenhagen, had created a framework to extract and generalize error message processing. This framework can be used across NAV. It comes with an API and new objects that you can reuse and plug into your own implementation. And part one of how to use it is described below.
NAV Design Patterns team Copenhagen
Note: This pattern describes new functionality which makes it possible to generalize the Journal Error Processing pattern.
Missing, invalid or incomplete data is a common issue during data processing in Microsoft Dynamics NAV. This article describes how to collect all error messages during processing using the error message component and present them to the user in a unified way, which enables the user to correct the errors efficiently. By leveraging the integrated error message logging functions, you can log a message with a single line of code and present it to the user with another one-liner.
This article describes how to use the Error Message component in Microsoft Dynamics NAV, which in short gives you the possibility to:
1. Link an error mesesage to the page which enables you to resolve the problem.
2. Assemble all error messages in one central view instead of having to encounter them one by one.
Validating data is a common task during data processing in Microsoft Dynamics NAV. Unfortunately, validation is often done using NAV’s integrated ERROR and TESTFIELD functions, which halt execution of the process. The user will then have to locate the invalid / missing data, correct it and reinitiate the process, possibly running into the next error, making the cycle repeat itself. This can be a very tedious, time-consuming and frustrating process. The error message component aims at improving this experience by providing a lightweight framework for error message logging and this article will explain how to leverage this functionality in your code. By doing so, all error messages are gathered during (pre-)processing and are finally presented to the user. The user then has the possibility to click on the error message, which will open the record where the invalid / missing data is located, thereby enabling the user to correct all mistakes efficiently, from one central place and in one go.
The example below comes from a Mexican localization, where the user has to export financial balances and transactions into an XML file for government audit purposes. In order to generate valid files, some mandatory data needs to be entered in the system. By leveraging the error message component, the user will be presented with the following page, if missing or invalid data was discovered:
By clicking on the error message, the user will be presented with the entity, where the invalid / missing data should be corrected / added.
Jesper Schulz at Microsoft Development Center Copenhagen
We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!