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

Referencing records and fields via RecordRef and FieldRef

The NAV datatype Record provides an interface to tables in the database. A certain limitation of the Record type is that a declaration of a Record variable is fixed in design time. Each variable must be linked to a table in the object design, and the link cannot be changed dynamically.

An alternative to static linking is the RecordRef datatype. A variable of RecordRef type is assigned to a specific table at runtime, but dynamics linking leads to higher complexity of code.

How to do it...

The RecordRef and FieldRef datatypes will be used to write a function comparing two records from the same table.

  1. Create a codeunit in the object designer and declare a local function CompareRecords in the codeunit. ...

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