Reader small image

You're reading from  Programming Microsoft Dynamics 365 Business Central - Sixth Edition

Product typeBook
Published inApr 2019
PublisherPackt
ISBN-139781789137798
Edition6th Edition
Right arrow
Authors (3):
Marije Brummel
Marije Brummel
author image
Marije Brummel

Author, programmer, consultant, project manager, presenter, evangelist, sales person, and a trainer. It's next to impossible to find someone as experienced as Marije Brummel in the Business Central community. Marije received the Microsoft MVP and the NAVUG All-Star awards among several others. She has chaired the Dynamics Credentialing committee and has authored official Microsoft Exam materials. She's the go-to girl for performance troubleshooting and upgrade challenges. One of her biggest achievements was introducing Design Patterns into the Business Central community. Her books, blog articles, and YouTube videos have influenced almost everyone involved with Business Central. She enjoys the outdoors with her dog and loves spending time with her family.
Read more about Marije Brummel

David Studebaker
David Studebaker
author image
David Studebaker

David Studebaker has been designing and developing software since 1962 as a developer, consultant, manager, and business owner. In 1967, David coauthored the first general-purpose SPOOL system, an AT&T / IBM joint project. He has been a founding partner in several firms, most recently Studebaker Technology and Liberty Grove Software. David's publications include a decade of technical reviews for ACM Computing Reviews and a number of articles on shop floor data collection. David originated the Packt series of books on programming Dynamics Business Central (aka Dynamics NAV). He has a BS in mechanical engineering from Purdue University and an MBA from the University of Chicago. He is a life member of the Association for Computing Machinery.
Read more about David Studebaker

Christopher D. Studebaker
Christopher D. Studebaker
author image
Christopher D. Studebaker

Chris Studebaker was a certified environmental consultant working with manufacturing facilities to meet national and state regulations before he started working with Navision in 1999. After working on regulatory reporting, data analysis, project management, and subcontractor oversight, Chris has used those skills to sell, develop, and implement NAV for the past 20 years. He has specialized in retail, manufacturing, job shop, and distribution implementations, mostly in high-user-count, high-data-volume applications. Chris acts in a consulting and training role for customers and for peer NAV professionals. He has a Bachelor of Science degree from Northern Illinois University and has done graduate work at Denmark Technical University.
Read more about Christopher D. Studebaker

View More author details
Right arrow
Preface

Welcome to the worldwide community of Microsoft Dynamics Business Central developers. This is a collegial environment populated by AL developers who readily and generously share their knowledge. There are formal and informal organizations of Business Central-focused users, developers, and vendor firms scattered around the globe and active on the web. Our community continues to grow and prosper, and now includes over 110,000 user companies worldwide.

The information in this book will help you shorten your learning curve on how to program for the Business Central ERP system using the AL language, the Visual Studio integrated development environment, and their capabilities. We hope you enjoy working with Business Central as much as we have.

A brief history of Business Central

Each new version of Microsoft Dynamics Business Central (formerly NAV) is the result of inspiration and hard work, along with some good fortune and expert technical investment over the last thirty years.

The beginning

Three college friends, Jesper Balser, Torben Wind, and Peter Bang, from Denmark Technical University (DTU) founded their computer software business in 1984 when they were in their early twenties; that business was PC Computing & Consulting (PC & C), and its first product was called PC Plus.

Single-user PC Plus

PC Plus was released in 1985 with the primary goal of ease of use. An early employee said its functional design was inspired by the combination of a manual ledger journal, an Epson FX 80 printer, and a Canon calculator. Incidentally, Peter Bang is the grandson of one of the founders of Bang & Olufsen, the manufacturer of home entertainment systems par excellence.

PC Plus was a PC DOS-based, single-user system. PC Plus' design included the following features:

  • An interface resembling the use of documents and calculators
  • Online help
  • Good exception handling
  • Minimal reliance on computer resources

The PC Plus product was marketed through dealers in Denmark and Norway.

Multi-user Navigator

In 1987, PC & C released a new product, the multi-user Navigator, and a new corporate name, Navision. Navigator was quite a technological leap forward. It included the following features:

  • Client/server technology
  • A relational database
  • Transaction-based processing
  • Version management
  • High-speed OLAP capabilities (SIFT technology)
  • A screen painter tool
  • A programmable report writer

In 1990, Navision was expanding its marketing and dealer recruitment efforts into Germany, Spain, and the United Kingdom. Also in 1990, a third version of Navigator was released. Navigator V3 was still a character-based system, albeit a very sophisticated one. If you had the opportunity to study Navigator V3.x, you would instantly recognize the roots of today's Business Central product. By V3, the product included the following features:

  • A design based on object-oriented concepts
  • Integrated 4GL Table, Form, and Report Design tools (the IDE)
  • Structured exception handling
  • Built-in resource management
  • The original programming language that became C/AL, which later changed to AL
  • Function libraries
  • The concept of regional or country-based localization

When Navigator V3.5 was released, it also included support for multiple platforms and multiple databases. Navigator V3.5 would run on both Unix and Windows NT networks. It supported Oracle and Informix databases, as well as those developed in-house.

At about this time, several major strategic efforts were initiated. On the technical side, the decision was made to develop a GUI-based product. The first prototype of Navision Financials (for Windows) was shown in 1992. At about the same time, a relationship was established that would take Navision into distribution in the United States. The initial release in the US in 1995 was V3.5 of the character-based product, rechristened Avista for US distribution.

Growth and mergers

In 2000, Navision Software A/S, and its primary Danish competitor, Damgaard A/S, merged. Product development and new releases continued for the primary products of both original firms (Navision and Axapta). In 2002, the now much larger Navision Software, with all of its products (Navision, Axapta, the smaller, older C5, and XAL) was purchased by Microsoft, becoming part of the Microsoft Business Systems division along with the previously-purchased Great Plains Software business, and its several product lines. The Navision and Great Plains products all received a common rebranding to become the Dynamics product line. Navision was renamed as Dynamics NAV, and later to Business Central.

Continuous enhancement

As early as 2003, research began with the Dynamics NAV development team, planning moves to further enhance NAV and take advantage of various parts of the Microsoft product line. Goals were defined to increase integration with products such as Microsoft Office and Microsoft Outlook. Goals were also set to leverage the functional capabilities of Visual Studio Code and SQL Server, among others. All the while, there was a determination not to lose the strength and flexibility of the base product.

NAV 2009 was released in late 2008, NAV 2013 in late 2012, followed by NAV 2015 in late 2014. NAV 2017 was released in October 2016. The biggest hurdles to the new technologies have been cleared. A new user interface, the Role Tailored Client, was created as part of this renewal. NAV was tightly integrated with Microsoft's SQL Server and other Microsoft products, such as Office, Outlook, and SharePoint. Development is more integrated with Visual Studio Code and is more .NET compliant. The product is becoming more open and, at the same time, more sophisticated, supporting features such as web services access, web and tablet clients, integration of third-party controls, RDLC and Word-based reporting, and so on.

Microsoft continues to invest in, enhance, and advance Business Central. More new capabilities and features are yet to come, with the aim of building on the successes of the past. We all benefit from their work.

AL's roots

One of the first questions asked by people new to AL is often, "What other programming language is it like?". The best response is Pascal. To those unfamiliar with Pascal, the next best response would be C or C#.

At the time the three founders of Navision were attending classes at Denmark Technical University (DTU), Pascal was widely used as a preferred language not only on computer courses, but on other courses where computers were tools and software had to be written for data analyses. Some of the strengths of Pascal as a tool in an educational environment also made it an ideal model for Navision's business applications development.

Perhaps coincidentally (or perhaps not), at the same time at DTU, a Pascal compiler called Blue Label Pascal was developed by Anders Hejlsberg. That compiler became the basis for what was Borland's Turbo Pascal, which was considered the everyman's compiler of the 1980s because of its low price. Anders went with his Pascal compiler to Borland. While he was there, Turbo Pascal morphed into the Delphi language and IDE tool set under his guidance.

Anders later left Borland and joined Microsoft, where he led the C# design team. Much of the NAV-related development at Microsoft is now being done in C#. Keeping it in the family, Anders' brother, Thomas Hejlsberg, also works at Microsoft as a software architect on Business Central. Each in their own way, Anders and Thomas continue to make significant contributions to Dynamics NAV.

In a discussion about AL and Visual Studio Code, Michael Nielsen of Navision and Microsoft, who developed the original AL compiler, runtime, and IDE, said that the design criteria provides an environment that can be used without the following tasks:

  • Dealing with memory and other resource handling
  • Thinking about exception handling and state
  • Thinking about database transactions and rollbacks
  • Knowing about set operations (SQL)
  • Knowing about OLAP (SIFT)

Paraphrasing some of Michael's additional comments, the goals of the language and IDE designs included:

  • Allowing the developer to focus on design rather than coding, but still allowing flexibility
  • Providing a syntax based on Pascal stripped of complexities, especially relating to memory management
  • Providing a limited set of predefined object types and reducing the complexity and learning curve
  • Implementing database versioning for a consistent and reliable view of the database
  • Making the developer and end user more at home by borrowing a large number of concepts from Office, Windows, Access, and other Microsoft products

Michael is now a co-founder and partner at ForNAV. Michael and his fellow team members are all about developing high-quality reporting enhancements for Dynamics Business Central, with the goal of making working with reports easy. This is another example of how, once we're part of the Business Central community, most of us want to stay part of that community.

Who this book is for

This book is for the following:

  • The business applications software designer or developer for whom the following is true:
    • Wants to become productive in Business Central Visual Code—AL development as quickly as possible
    • Understands business applications and the type of software required to support those applications
    • Has significant programming experience
    • Has access to a copy of Business Central, including the Designer granules and a standard Cronus demo database
    • Is willing to do the exercises to get hands-on experience
  • The reseller manager or executive who wants a concise, in-depth view of Business Central's development environment and tool set.
  • The technically knowledgeable manager or executive of a firm using Business Central that is about to embark on a significant Business Central enhancement project.
  • The technically knowledgeable manager or executive of a firm considering the purchase of Business Central as a highly-customizable business applications platform.
  • The experienced business analyst, consultant, or advanced student of applications software development who wants to learn more about Business Central because it is one of the most widely used, and most flexible, business application systems available.

The reader of this book does not need the following:

  • Does not need to be an expert in object-oriented programming
  • Does not need previous experience with Business Central, AL, or Visual Studio Code

What this book covers

Chapter 1, Introduction to Business Central, starts with an overview of Business Central as a business application system, which is followed by an introduction to the seven types of Business Central objects, as well as the basics of AL and Visual Studio Code. It then presents the opportunity for some hands-on work, such as defining tables, multiple page types, and reports. This chapter will close with a brief discussion of how backups and documentations are handled in Visual Studio Code.

Chapter 2, Tables, focuses on the foundation level of Business Central's data structure: tables and their structures. This chapter covers properties, triggers (where AL resides), field groups, table relations, and SumIndexFields. It will then present the hands-on creation of several tables in support of an example application. The chapter will also review the types of tables found in the Business Central applications.

Chapter 3, Data Types and Fieldswill teach you about fields, the basic building blocks of Business Central's data structure. It will review the different data types in Business Central and cover all of its field properties and triggers in detail, as well as review the three different field classes.

Chapter 4, Pages – The Interactive Interfacereviews the different types of pages, their structures (triggers and properties), and general usage. The chapter will encourage readers to build several pages for an example application using snippets. It will also explore the different types of controls that can be used in pages. In addition, this chapter will review how and where actions are added to pages.

Chapter 5, Queries and Reports, teaches you about both queries and reports—two methods of extracting data for presentation to users. It will show readers how queries are constructed and some of the different ways they are utilized. It will also offer a walk-through for reporting data flow in reports, and what the different report types are. This chapter will present two Report Designers: the Visual Studio Report Designer and the Visual Studio Report Designer, and will explain how a Business Central report is constructed using both of these and in what scenarios they are best applied. This chapter will also discuss properties and triggers, before reviewing how reports can be made interactive with hands-on report creation.

Chapter 6, Introduction to AL, explains general object designer navigation, as well as the individual designers (table, page, and report). It will explore AL code construction, syntax, variable types, expressions, operators, and functions. The chapter will then offer a closer look at some of the more frequently used built-in functions. This chapter will wrap up with an exercise that adds AL code to a report object created in an earlier exercise.

Chapter 7, Intermediate ALdigs deeper into AL development tools and techniques. It will review some more advanced built-in functions, including those relating to dates and decimal calculations—both critical business application tools. This chapter will also explore AL functions that support process flow control functions, input and output, and filtering, before reviewing methods of communication between objects. Finally, this chapter offers the opportunity to practically enhance an example application.

Chapter 8, Advanced AL Development Toolsreviews some of the more important elements of Role's tailored user experience; in particular, the Role Center page construction. It will dig into the components of a Role Center page and how to build one. This chapter will also cover two powerful ways of connecting Business Central applications to the world outside of Business Central, using XMLports and web services. To better understand these, the chapter will not only review their individual component parts, but will also go through the hands-on effort of building an example of each one.

Chapter 9, Successful Conclusionsgives readers a detailed study of how Business Central functions are constructed, and will explain how to construct functions. This chapter will include more information about the tools and features built into AL and Visual Studio Code, as well as the new debugger. It will also review support for test-driven development, and take a look at how to integrate .NET Client Add-ins with example applications. Finally, it will review tips for design efficiency, and updating and upgrading the system, all with the goal of helping readers become more productive, high-quality Business Central developers.

To get the most out of this book

To get the maximum out of this book as a developer, the following should match you:

  • Be an experienced developer
  • Know more than one programming language
  • Have IDE experience
  • Be knowledgeable about business applications
  • Be good at self-directed study

If you have these attributes, this book will help you become productive with AL and Business Central much more rapidly.

Even though this book is targeted first at developers, it is also designed to be useful to executives, consultants, managers, business owners, and others who want to learn about the development technology and operational capabilities of Dynamics 365 Business Central. If you fit into one of these, or similar, categories, start by studying Chapter 1 for a good overview of Business Central and its tools. You should then consider reviewing sections of other chapters, where specific topics may apply to your specific areas of interest.

This book's illustrations are from the W1 Cronus database, Dynamics 365 Business Central V2017.

You will need some basic tools to get the most of this book, including the following:

  • A license and database that can be used for development experimentation. The ideal license is a full developer's license. If your license only contains the page, report, and table designer capabilities, you will still be able to do many of the exercises, but you will not have access to the inner workings of pages and tables and the AL code contained therein.

Access to other Business Central manuals, training materials, websites, and experienced associates will obviously be of benefit, but they are not required for the time spent with this book to be a good investment.

Downloading the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Programming-Microsoft-Dynamics-365-Business-Central-Sixth-EditionIn case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. An example of this is as follows: "The HelloWorld.al file can be deleted immediately."

A block of code is set as follows:

IF Type = 'Resource' THEN No. := Resource.No. 
ELSE IF Type = 'Show' THEN No. := Radio Show.No.
ELSE IF Type = 'Item' THEN No. := Item.No. )

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold, as follows:

IF Type = 'Resource' THEN No. := Resource.No. 
ELSE IF Type = 'Show' THEN No. := Radio Show.No.
ELSE IF Type = 'Item' THEN No. := Item.No. )

Any command-line input or output is written as follows:

$ cd css

Bold indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this, such as "From Visual Studio Code, click on New, then click on File."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email feedback@packtpub.com and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at questions@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you could report this to us. Please visit www.packtpub.com/submit-errata, select your book, click on the Errata Submission Form link, and enter the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you could provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.

Becoming an author: If there is a topic that you have expertise in and you are interested in either writing about or contributing to, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Programming Microsoft Dynamics 365 Business Central - Sixth Edition
Published in: Apr 2019Publisher: PacktISBN-13: 9781789137798
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.
undefined
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 $15.99/month. Cancel anytime

Authors (3)

author image
Marije Brummel

Author, programmer, consultant, project manager, presenter, evangelist, sales person, and a trainer. It's next to impossible to find someone as experienced as Marije Brummel in the Business Central community. Marije received the Microsoft MVP and the NAVUG All-Star awards among several others. She has chaired the Dynamics Credentialing committee and has authored official Microsoft Exam materials. She's the go-to girl for performance troubleshooting and upgrade challenges. One of her biggest achievements was introducing Design Patterns into the Business Central community. Her books, blog articles, and YouTube videos have influenced almost everyone involved with Business Central. She enjoys the outdoors with her dog and loves spending time with her family.
Read more about Marije Brummel

author image
David Studebaker

David Studebaker has been designing and developing software since 1962 as a developer, consultant, manager, and business owner. In 1967, David coauthored the first general-purpose SPOOL system, an AT&T / IBM joint project. He has been a founding partner in several firms, most recently Studebaker Technology and Liberty Grove Software. David's publications include a decade of technical reviews for ACM Computing Reviews and a number of articles on shop floor data collection. David originated the Packt series of books on programming Dynamics Business Central (aka Dynamics NAV). He has a BS in mechanical engineering from Purdue University and an MBA from the University of Chicago. He is a life member of the Association for Computing Machinery.
Read more about David Studebaker

author image
Christopher D. Studebaker

Chris Studebaker was a certified environmental consultant working with manufacturing facilities to meet national and state regulations before he started working with Navision in 1999. After working on regulatory reporting, data analysis, project management, and subcontractor oversight, Chris has used those skills to sell, develop, and implement NAV for the past 20 years. He has specialized in retail, manufacturing, job shop, and distribution implementations, mostly in high-user-count, high-data-volume applications. Chris acts in a consulting and training role for customers and for peer NAV professionals. He has a Bachelor of Science degree from Northern Illinois University and has done graduate work at Denmark Technical University.
Read more about Christopher D. Studebaker