Installing and upgrading codeunits
When you create an extension, you could encounter the need to check some conditions for the installation to be successful, or you could need to initiate some setup tables or pre-populate other tables. To do this, you need to create an 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 are reinstalling 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()
: The code inside this trigger runs once for the entire install process.
The same logic occurs when upgrading the extension. If you need to create a new...