Code alterations in Dynamics 365 Business Central – What you need to know

In autumn 2018, Microsoft plans to combine the cloud-product Dynamics 365 with the on-premise solution Dynamics NAV. The name and the code base will become the same – but, the cloud version will be different when it comes to code alterations in the application.

Code alterations to the base application of Dynamics 365 Business Central was and is one of the major benefits of this ERP-system. Microsoft is keen to keep this asset. But, auto enrollment of updates and the Azure cloud-environment do limit the freedom. Therefore, the cloud and the on-premise version will have two characteristics when it comes to code alterations. The on-premise version will allow full access to the code of the base application. And the cloud version will be “limited” to so-called Extensions.

Dynamics 365 Business Central in the cloud …

Microsoft does update the cloud-version automatically in the back-end as soon as the Dynamics-Team releases a new cumulative update. This is a real benefit for the user, because Microsoft assures that the latest version is active without technical knowledge or involvement of a Partner. But, this approach limits modifications to the application itself. Each auto enrollment of an cumulative update would simply overwrite any modification to the base application. Hence, Microsoft allows modifications to the application by using Extensions only.

… and on-premise

The on-premise version will allow the unlimited access to the code of the core application (as known from its ancestor versions) and Extensions. But with freedom comes more administrative effort to maintain the IT-environment: The infrastructure and cumulative updates must be maintained individually with the help of a Partner.

Extending the application

Microsoft introduced with Dynamics 365 a new platform to purchase and install new modules. The AppSource store is a new platform to select and download Extensions. Every user/administrator is able to download an Extension and make it available in the company’s Dynamics 365. Consequently, this is valid for both versions – cloud & on-premise.

Fortunately, Microsoft does provide quality assurance for Extensions published through AppSource. Therefore, Extensions which are able to threaten and compromise the database should be filtered out by Microsoft. Almost it is the same approach as Apple applies for new Apps in the AppStore. In addition, Extensions are in the world of software nothing new. For example, Plug-ins are supported by most popular web browsers.

Extensions are basically doing what the name promises – they are extending the application. As a result, it means that code alterations to the existing system are not possible. The advantage of this approach is, that it is possible to install, uninstall and updated an Extensions without access to the development environment. Microsoft intended to design the process as user-friendly as possible.

Additionally, Extensions are designed to protect the core system of Dynamics 365. Hence, it is not possible for Extensions to alter the core application (it “extends” only). As a result, theoretically, even without quality assurance, the integrity of the core application is guaranteed when installing an Extension.

Technical limitations of Extensions

Unfortunately, with security does come restriction. Compared to the “full access” of the on-premise version, the cloud version of Dynamics 365 Business Central will not provide the same adaptability. Therefore this is an important point to consider, when it is necessary to amend the core application to fit the requirements of the business.

Due to restrictions, using Extensions it is not possible…

  • … to modify any existing code.
  • … to delete existing Pages, Tables or Fields.
  • … modify certain properties of Tables, Fields and Pages.
  • … to utilize the .NET-Framework.

In addition, it is possible to create new…

  • … Tables and Fields.
  • … Pages.
  • … Actions in existing Pages.
  • … Azure Functions.

Furthermore, a new development which is based on a process, can be implemented by so-called Events. An Event is a trigger which executes code in specific situations. For example, when a user prints an invoice, it is possible to execute bespoke code around (i.g. create an entry in a Log). Due to their importance, Microsoft normally integrates new Events in every cumulative update and it is possible to request new Events.

So, not every program situation is covered by Events. Therefor, a developer might face the situation in which it is not possible to integrate code for a certain situation.

In opposite, the on-premise version will allow access to the core application. It is possible for a developer to alter code or to create new Events in the core. But, each alteration in the core will enlarge the manual installation of cumulative updates.

For example…

I have collected a couple of examples of code alterations to show if it is possible to do this code alteration in the cloud and/or on-premise version. Please feel free to add your examples or questions in the comments.

Alteration Cloud On-premise
Add a new Action to the Customer List to show all Posted Sales Invoices of the selected Customer Yes Yes
Setup mandatory Dimensions for a new Table No Yes
Match additional fields when importing a Bank Statement file No Yes
Print UPS-Label Yes Yes
Create new Events No Yes
New module to maintain company  cars Yes Yes
Do not allow to post a Sales Document when status is “Pending Approval” No Yes
Change the Lookup-/Drilldown-Page of an existing Table No Yes

Takeaway

Due to the technical differences, the decision to choose the cloud or the on-premise version of Dynamics 365 Business Central will also be influenced by the planned code alterations to the application.

The cloud version does offer useful and user-friendly expandability with Extensions at low maintenance. Due to restrictions it might be possible that certain code alterations are not possible.

Finally, the on-premise version will still offer the flexibility to alter the code of the core application. Therefore, this version is ready for everything what the future might bring. But this flexibility comes with more responsibility (i.g. manual installation of cumulative update, SQL backups) and higher costs.

3 thoughts on “Code alterations in Dynamics 365 Business Central – What you need to know”

  1. Nice informative article. On cloud, Events cannot be created means events can be subscribed but not published, is my understanding correct? If events can be subscribed “Restrict sales document post when status is pending” can be accomplished by subscribing onbeforesalespost or some other published events?

    1. Hi,

      For the Cloud-version, you are able to create Publisher-Events in Extensions (only). Subscriptions-Events can listen to any available Publisher-Event (Standard or Extension).

      The Publisher-Event “OnBeforePostSalesDoc” of Codeunit 80 is executed before any Code of that Codeunit (Yes, you could use this trigger for “Restrict sales document post when status is pending”).

Leave a Comment

Your email address will not be published. Required fields are marked *