Installing and upgrading codeunits
When you create an extension, you could have the 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()
: 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 version of your extension (the version number in the app.json
...