Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Dynamics NAV 2013 Application Design

You're reading from   Microsoft Dynamics NAV 2013 Application Design Customize and extend your vertical applications with Microsoft Dynamics NAV 2013

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher Packt
ISBN-13 9781782170365
Length 504 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Marije Brummel Marije Brummel
Author Profile Icon Marije Brummel
Marije Brummel
Mark Brummel Mark Brummel
Author Profile Icon Mark Brummel
Mark Brummel
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Chapter 1: Introduction to Microsoft Dynamics NAV 2. Chapter 2: A Sample Application FREE CHAPTER 3. Chapter 3: Financial Management 4. Chapter 4: Relationship Management 5. Chapter 5: Production 6. Chapter 6: Trade 7. Chapter 7: Storage and Logistics 8. Chapter 8: Consulting 9. Chapter 9: Interfacing 10. Chapter 10: Application Design 11. Installation Guide

The building blocks

To understand the development examples in this book, we will discuss some of the basic building blocks of Microsoft Dynamics NAV 2013.

Like all database applications, it starts with tables. They contain all the information displayed in a structured way. It is important to understand that the tables of Microsoft Dynamics NAV are not completely normalized. The tables are structured in the way the user interface works. This makes it easy for nontechnical people to understand the data model. We'll discuss the unique structure of the application in Chapter 2, A Sample Application.

Tables, however, not only contain data, but they contain business logic as well. As they are structured like the functionality in the database, tables contain simple functions like address validation and more complex functions for VAT and discount calculation.

Whenever functionality gets more complex or can be shared across the application, it is better to move them to the codeunit object. These are containers of business logic for a special purpose. Tables can also be used as a class without storing data. This allows more structured programming.

For the user interface, there are two object types: reports and pages. Reports are originally intended to be printed on paper but with the current status of technology, they are more and more used as information dashboards, combining management information with drill-through possibilities.

As the tables are structured in the way the application works, the pages are bound to one table. For people new to this concept, it sometimes takes a while to get used to this.

The Menu Suite defines the way the navigation is structured when people leave their Role Centers and go to the department pages. The Menu Suite is used for the Search window.

The last object type is an external interface object. XML ports make it possible to import and export data in and out of the system.

Query objects are introduced in Microsoft Dynamics NAV 2013 and allow developers to define SQL Server SELECT statements on the metadata level that can be used in 
C/AL code. It is possible to join multiple tables into one query. Query objects can also be exposed as OData web services.

For this book, the table and page objects are the most important to understand. Most of this book, however, can also be applied to older versions but then forms should be applied wherever this book addresses pages.

Tables as user interface and business logic

The table object in Microsoft Dynamics NAV is very important. Since it is not normalized, it contains a lot of information about how the database works.

For example, the Job Card (88) is built on one table, the Job (167). This table contains all the fields required for this screen.

In a traditional development environment, this screen would have a transaction GetJobData and UpdateJobData. These transactions would read the information from the database, map them to the screen, and save the information in the database if the user is finished. However, in Microsoft Dynamics NAV, all fields that are displayed in the interface are stored in one table. This makes it possible for the screen to have built-in triggers to get the data and update the database.

The table object then contains the business logic required for this document. Let's have a look at some of the fields in this table:

In the preceding screenshot, we can see a lot of fields such as WIP Method, Currency Code, and so on, which are required for a job.

When we click on the C/AL Code icon and we focus on currency code, we get the following result:

Currency Code - OnValidate()

IF "Currency Code" <> xRec."Currency Code" THEN

IF NOT JobLedgEntryExist THEN

CurrencyUpdatePlanningLines

ELSE

ERROR(Text000,FIELDCAPTION("Currency Code"),TABLECAPTION);

This contains business logic that gets executed every time something happens with this field. In this case, the currency factor is recalculated and updated in the sales lines.

So the tables in Microsoft Dynamics NAV are not just data containers, they are the foundation for both the business logic and the application workflow.

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 €18.99/month. Cancel anytime