Where to write customized code
While writing your own customized code for Dynamics NAV, it is important to choose where to write that code. Code can be written in different places and the application will still work as you had intended. Unfortunately, not all places are good choices. Depending on where you write your code, it may be easier or more difficult to expand or change functionality. In this section, we will give you some guidelines for choosing where to write your code.
Validating fields
When a field is filled, a special trigger runs the OnValidate
trigger of the field. For a given field, you will find an OnValidate
trigger on the page where the user enters the data and also on the table itself. Whenever possible, write your code on the OnValidate
trigger of the table.
A field can be shown on multiple pages. If you choose to validate the field on the page, you will have to replicate your code in all the pages where the field is shown. This will make your code difficult to maintain...