O'Reilly logo

Extending Microsoft Dynamics NAV 2016 Cookbook by Alexander Drogin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Designing reusable code

Code modules in NAV are called codeunits. A codeunit does not have any user interface; the only purpose of a codeunit object is to store application code that can be called from other objects.

How to do it...

Now we will create a codeunit that will store functions common for objects in the current chapter, and move duplicated code from different objects into the codeunit.

  1. Create a new codeunit in object designer. Save it as codeunit 50010 Item Certificate Mgt.
  2. Declare a global function GetCertificateExpirationDate.
  3. Select the function in C/AL Globals list and open its properties. By default, property Local is set to Yes. Change it to No to make the function accessible from other objects.
  4. Open function parameters in C/AL Locals ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required