The Number Series Pattern
When working with the ERP systems, issue numbers are issued to identify records in tables, which is a key requirement. Microsoft Dynamics NAV has a similar numbering engine built into the system as a part of the application. The engine is written in C/AL, and is accessible to be changed by developers.
More information can be found in the How Do I video, available at https://www.youtube.com/watch?v=1lG9rY_dmM4&list=PLhZ3P-LY7CqmVszuvtJLujFyHpsVN0U_w&index=8.
Although it is possible to change the behavior of the engine, best practice is not to do so. The engine can be used from any part of the system by implementing a few steps.
The NoSeriesManagement Codeunit has a number of functions, such as TestManual, InitSeries, and LookupSeries. We will focus on how to implement them as part of the primary key. Another example is to implement Number Series to automatically populate the Document No. field in the Journal Lines....