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

Compiling objects and error handling

The C/AL code in NAV objects is not executable itself. Before a C/AL object can be used in the application, it must be compiled into binary code that can be run.

The C/AL compiler is a part of the C/SIDE development environment, and can be run either from the object designer or in the code editor while writing the application code.

How to do it...

  1. Open NAV object designer and create a new codeunit.
  2. In the OnRun trigger, declare a local variable CurrDate of type Integer:

    Name

    DataType

    CurrDate

    Integer

  3. Add two code lines in the OnRun trigger:
            CurrDate := TODAY; 
            MESSAGE('Today is %1,CurrDate); 
    
  4. The preceding code contains two errors. Let's try to compile it. Press F11 or click Compile in the Tools menu to ...

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