Creating new C/AL routines

Now that we have a good overall picture of how we enable users to access the tools we create, we are ready to start creating our own NAV C/AL routines. It is important that you learn your way around the NAV C/AL code in the standard product first. You may recall the advice in a previous chapter that the new code we create should be visually and logically compatible with what already exists. If we think of our new code as a guest being hosted by the original system, we will be doing what any thoughtful guest does: fitting smoothly into the host's environment.

An equally important aspect of becoming familiar with the existing code is to increase the likelihood; we can take advantage of the features and components of the standard product to address some of our application requirements. There are at least two types of existing NAV C/AL code of which we should make use whenever appropriate.

One group is the callable functions that are used liberally throughout NAV. Once we know about these, we can use them in our logic whenever they fit. There is no documentation for most of these functions, so we must either learn about them here or by doing our homework and studying NAV code. The second group includes the many code snippets we can copy when we face a problem similar to something the NAV developers have already addressed.

The code snippets differ from the callable functions in two ways. First, they are not structured as coherent and callable entities. Second, they are likely to serve as models, code that must be modified to fit the situation by changing variable names, adding or removing constraints, and so on.

In addition to the directly usable C/AL code, we should also make liberal use of the NAV Design Patterns Repository located at https://community.dynamics.com/nav/w/designpatterns/105.nav-design-patterns-repository.aspx.

NAV Design Patterns provide common definitions of how certain types of functions are implemented in NAV. Some of the Pattern examples include the following:

  • Copy Document
  • Create Data from Templates
  • No. Series
  • Single-Record (Setup) Table
  • Master Data

There are many other patterns, and new pattern definitions are frequently added.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.16.184