Installing and upgrading codeunits

When you develop an extension, there's also an important aspect to take care of: installation and upgrading operations. When an extension is installed or upgraded, you often need to perform certain operations on data, such as populating new data and restoring existing ones. These tasks can be achieved by writing extension-install-and-upgrade code.

In this type of code, you can access the extension properties (such as version, name, publisher, and dependencies) by using the NAVApp.GetCurrentModuleInfo() and NAVAPP.GetModuleInfo() methods.

The install logic can be written by creating an install codeunit, that is, a codeunit with SubType = Install.

An install codeunit has two main system triggers:

  • OnInstallAppPerCompany() ...

Get Dynamics 365 Business Central Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.