Installing and upgrading codeunits

When you create an extension, you need to check some conditions for the installation to be successful, or you need to initiate some setup tables or pre-populate other tables. To do this, you need to create Install codeunit.

The extension's install logic must be written in a codeunit with the SubType property set to Install. This logic is triggered when the following is true:

  • You're installing the extension for the first time.
  • You have uninstalled the extension and then you're installing it again.

An Install codeunit supports the following system triggers:

  • OnInstallAppPerCompany(): The code inside this trigger runs once for each company in the Dynamics 365 Business Central database.
  • OnInstallAppPerDatabase() ...

Get Mastering Microsoft Dynamics 365 Business Central 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.