Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Dynamics NAV Development Quick Start Guide

You're reading from   Microsoft Dynamics NAV Development Quick Start Guide Get up and running with Microsoft Dynamics NAV

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher Packt
ISBN-13 9781789612769
Length 210 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Alexander Drogin Alexander Drogin
Author Profile Icon Alexander Drogin
Alexander Drogin
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Getting Started with the NAV Development Environment FREE CHAPTER 2. Codeunits - Structuring C/AL Code 3. Tables - Creating Data Structure 4. Designing User Interface 5. Exchanging Data with XML Ports 6. NAV Event Model 7. Presenting Data in Reports 8. Debugging Your Code 9. Other Books You May Enjoy

Rec and xRec global variables

In the previous section dedicated to table triggers, we referred to the fields of the current table by simply naming these fields, such as Starting Date, Ending Date, or Customer Group Code. In fact, these fields belong to a global variable, Rec, that always exists within the context of a table and refers to the table instance itself. References to table fields are implicitly resolved to Rec if the record context is not specified explicitly.

Any data manipulation functions are also applied to the context of the current record instance when called without a variable reference. If, for example, we want to make sure that the user fills the item code in the contract line before specifying the amount, we could do it by calling TESTFIELD on the Item No. in the context of the current record. Here is the code to do the validation in the the OnValidate trigger...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image