bcquality/microsoft/knowledge/upgrade/install-code-does-not-run-on-version-upgrade.md
Jesper Schulz-Wedde e0ebdd35c7
Add lifecycle error and privacy knowledge (#99)
* Add lifecycle error and privacy knowledge

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec

* Fix lifecycle privacy review findings

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a26cd6d6-ff49-433e-bc53-f645c455ebdd

* Refine lifecycle privacy retrieval

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec

* Make review gates explicit

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 95c06ad8-377d-4faa-8d07-06300b1c81ec

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-14 12:52:56 +02:00

1.1 KiB

bc-version domain keywords technologies countries application-area
all
upgrade
install-codeunit
subtype-install
on-install-app
version-upgrade
upgrade-codeunit
al
w1
all

Install code does not run during a version upgrade

Description

An install codeunit runs when an extension is installed for the first time or an uninstalled version is installed again. Installing a higher extension version through the data-upgrade operation does not invoke OnInstallAppPerCompany or OnInstallAppPerDatabase. Ordinary version-to-version migration is dispatched only through upgrade codeunits.

Best Practice

Use Subtype = Install for first-install and reinstall initialization. Put version migration in a separate Subtype = Upgrade codeunit and enter it from OnUpgradePerCompany or OnUpgradePerDatabase.

See sample: install-code-does-not-run-on-version-upgrade.good.al.

Anti Pattern

Putting a schema or data migration only in an install trigger and expecting it to run when a higher app version is upgraded. The migration is never invoked on that path.

See sample: install-code-does-not-run-on-version-upgrade.bad.al.