The Multi-Level Setup Pattern
From an architectural perspective, the Singleton Pattern works together quite well with the Multi-Level Setup Pattern. We will implement this in our Example application by adding a Boolean that enables or disables the use of our little add-on.
The idea is to be able to enable the application for individual users or on a database level.
Let's start by implementing a new field on the Setup table that allows us to enable the application. We will also add this field to the page.
Microsoft Dynamics NAV already has a table (User Setup) where users can enter preferences. Instead of creating our own, we will add a field to this table. This is what users of the product expect when working with the system. Each module in NAV has a limited set of options in this table. If we add a large range of setup options we may create our own table. In case of a new table, we are probably building a large vertical application, rather than a small module.
The following...