microsoft / BCApps

Repository for collaboration on Microsoft Dynamics 365 Business Central applications.
https://microsoft.github.io/BCApps/
MIT License
330 stars 170 forks source link

[BC Idea]: Trigger Upgrade Logic including DataTransfer from AL #1659

Open JohnnyUndercover opened 4 months ago

JohnnyUndercover commented 4 months ago

BC Idea Link

https://experience.dynamics.com/ideas/idea/?ideaid=5fd11dbc-914d-ef11-b4ac-6045bd8476a6

Description

From the Idea From time to time we have features that replace existing features. If we enable the new feature we need to transfer data from the old tables and fields to the new ones.

We want to be able to trigger the upgrade from the ui, similar to the functionality in the feature managemnt page.

But if we do the upgrade with normal al code (using repeat until) the upgrade is pretty slow and if somthing goes wrong we are in a bad position..

The solution would be faster upgrade code. We can achive this by using DataTransfer inside of Upgrade or Install Codeunits. But currently we cannot trigger this code from the UI (or throught AL Code).

Suggested solution that we can implement now

I suggest to add a new Procedure "ReinstallExtension" to the Extension Management Codeunit. The procedure would uninstall and then reinstall the extension. This would trigger the Install Codeunit of the extension. Inside of the Install Codeunit of the extension we can then check if we need to run our upgrade code or not and upgrade the data using DataTransfer.

I will provide the implementation for this BC Idea

JesperSchulz commented 3 months ago

Hi @JohnnyUndercover,

while I get your scenario, your solution does sound more like a workaround than like a proper solution.

Allow me to discuss internally.

JohnnyUndercover commented 3 months ago

Completely agree. Would be nice to be able to run uprade code without reinstalling the app.