Dynamics NAV | 365 Business Central Development Tools

Published on 09 Jul 2018

Topics: Techy Stuff

The next generation of development code!

Ever since Dynamics NAV burst on to the scene over 25 years ago, one of its most standout features has been its development tools. From the very beginning Dynamics NAV was built with the ability for developers to get their hands dirty and totally customise the way the system worked.

However, this wasn’t just restricted to our friends at Navision (and more recently Microsoft), these same tools that were used to create the core functionality of the system were available to anyone with a development licence and some strong coffee. As a result, almost every Dynamics NAV system that has ever been installed has had some level of customisation done to make the solution fit the intended business. Unfortunately, this flexibility has also caused some issues that over the last few years Microsoft have been working to solve.

Dynamics NAV development tools

The power and flexibility of Dynamics NAV’s development tools mean that you really can tailor the system to your needs, from the rounding of some ‘sharp edges’ to inventing whole new business processes. However, the problems begin to surface when it comes to upgrading your system. In the old days, whenever you wanted to make a change to Dynamics NAV, you would literally change the way the standard functionality worked. So, if you want to add some new processes around the receipt of Purchase Orders, you would probably add some fields to the ‘Purchase Header’ table, maybe change some code in the codeunit ‘Purch.-Post’. Then, when it came to upgrading to the next version of Dynamics NAV, someone would need to take a look at the new versions of the ‘Purchase Header’ table and ‘Purch.-Post’ codeunit that Microsoft had created. They would then have to manually work out how to fit your changes in with the new version. Multiply this across the numerous bits of development that are done in a reasonable sized Dynamics NAV system, and it adds up to a lot of time, effort and also risk.

So, what have Microsoft done to help ease this pain? Their focus has been on allowing developers to make those same changes, but this time without changing the standard Dynamics NAV functionality. The major piece of technology that Microsoft have created is something called ‘Events and Subscribers’. Throughout the Dynamics NAV code, Microsoft have added a myriad of ‘Published Events’. These are points in the system the developers can hook into and run their custom code using a ‘Subscriber’. So now, no matter what changes are made in each version of Dynamics NAV, whenever that Event is triggered, your custom code will be called. In our example above, a developer would no longer have to change the codeunit ‘Purch.-Post’, instead they can subscribe to the Event ‘OnBeforePostPurchaseDoc’ and keep their code nicely separate. Come upgrade time, the original codeunit can be happily upgraded as it no longer has any changes in it.

However, as wonderful as this all sounds, there is a caveat which should be mentioned. Events work beautifully if Microsoft have added an Event at the place you need it. However, there are still several places throughout the system where Events aren’t published. If the custom code needs to be triggered at a point where there is no Event, then unfortunately the only option is to revert back to the old mechanism of changing the standard object.

The power and flexibility of Dynamics NAV's development tools mean that you really can tailor the system to your needs, from the rounding of some 'sharp edges' to inventing whole new business processes.

Microsoft extensions

The second piece of technology that Microsoft has introduced is something called ‘Extensions’. This is a way of packaging up a whole host of changes so that they can be delivered to various Dynamics NAV systems without the messy task of delivering all the objects and changes manually each time. These Extension can not only deliver custom code, but they can also be used to add fields to tables, change the layout of pages and even add totally new objects to the system. There’s an issue here though, how can you take a customised page (for example) and deliver it to two totally different Dynamics NAV systems? Surely that would overwrite any changes that have been made to that page in those systems? This is where the magic trick occurs.

Microsoft have invented a whole new way of describing changes to Dynamics NAV tables/pages etc. (In fact they’ve invented two ways, but more on that later). So, instead of the Extension having a copy of my new Purchase Order page, instead it only contains information about the extra field I’ve added. So, when the Extension is installed on your Dynamics NAV system, instead of overwriting the entire page, it simply adds the new field. Of course, as with Events, there are limits to what can currently be achieved with Extensions, for example you can add new fields, but you can’t remove existing ones. You can add new code, but you can’t change existing code.

Extensions were released in Dynamics NAV 2016, and were based on the concept of a DELTA file. This was the file that contained the description of the change the extension made. However, there were some issues with these DELTA files, in particular they weren’t great at handling clashes between two different Extensions. So, now Microsoft are releasing a new method for creating Extensions based upon a totally new development language for Dynamics NAV called ‘AL’. This is a language designed from the ground up for creating Extensions, and introduces not just a new development environment (it uses Microsoft’s new Visual Studio Code application), but some new object types called PageExtension and TableExtension that give us a whole new way to develop changes for Dynamics NAV.

Given that the Extensions functionality means that developers can now write changes for Dynamics NAV that can be easily delivered to multiple systems, the logical next step is being able to publish these Extensions to a web store. Microsoft have now added the ability for Partners to publish their Apps/ Extensions to the AppSource web store. This means that with the release of Dynamics 365 Business Central customers will be able to simply install these Apps to their systems much like you would install an app on your phone. This opens up a whole new world for both Dynamics NAV developers and customers, with easy access to a bevy of Dynamics NAV apps that don’t impact the upgradeability of systems. The future should see many more Dynamics NAV systems being regularly updated, and with significantly less ‘custom’ development. Learn how to develop an extension for Dynamics 365 Business Central with our Knowledge Session.

Get in Touch with The NAV People

Written by
TNP
TNP