Book Image

Extending Microsoft Dynamics NAV 2016 Cookbook

By : Alexander Drogin
Book Image

Extending Microsoft Dynamics NAV 2016 Cookbook

By: Alexander Drogin

Overview of this book

Microsoft Dynamics NAV is an enterprise resource planning (ERP) software suite for organizations. The system offers specialized functionality for manufacturing, distribution, government, retail, and other industries. Its integrated development environment enables customizations with minimal disruption to business processes. The book starts explaining the new features of Dynamics NAV along with how to create and modify a simple module. Moving on, you will learn the importance of thinking beyond the boundaries of C/AL development and the possibilities opened by with it. Next, you will get to know how COM can be used to extend the functionalities of Dynamics NAV. You’ll find out how to extend the Dynamics NAV 2016 version using .NET interoperability and will see the steps required to subscribe to .NET events in order to extend Dynamics NAV. Finally, you’ll see the cmdlets available to manage extension packages. By the end of the book, you will have the knowledge needed to become more efficient in selecting the extending methods, developing and deploying them to the Dynamics NAV, and practicing the best practices.
Table of Contents (17 chapters)
Extending Microsoft Dynamics NAV 2016 Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

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. This is the function that will do the comparison. Set the function's return type to Boolean.

  2. Access the C/AL Locals in the function CompareRecords, declare a parameter RecRef of type RecordRef. After that, open the parameter properties and set...