Skip to content

[DRAFT] Add Procedure ReinstallExtension to trigger Install Code from AL #1657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JohnnyUndercover
Copy link

@JohnnyUndercover JohnnyUndercover commented Jul 29, 2024

This is a Draft because i think this is a hack and could be better solved by adding a possibility to trigger upgrade code (with DataTransfer) from AL Code.
But currently this seems to be the only way to trigger code that uses DataTransfer from AL.

Summary

Adds a new Procedure "ReinstallExtension" to Extension Management. The Procedure uninstalls and then installs the extension again. It also reinstalls the extensions that are dependent on the reinstalled extension.

By Installing the Extension the Install Codeunints of the extension are triggered.
Inside Install Codeunits we can use DataTransfer to move Data between Tables/Fields.
This is usefull if you have features that can be enabled by the user, but these features require some data beeing moved to new tables/fields. If we copy the Data using repeat until this can be very slow and time consuming. Accordin to the docs using DataTransfer instead, can result in a "~200x performance improvement".

Work Item(s)

Fixes #1659

@github-actions github-actions bot added AL: System Application From Fork Pull request is coming from a fork labels Jul 29, 2024
Copy link

Issue #1659 is not valid. Please make sure you link an issue that exists, is open and is approved.

@JesperSchulz JesperSchulz added the Integration GitHub request for Integration area label Aug 14, 2024
@JesperSchulz JesperSchulz changed the title Add Procedure ReinstallExtension to trigger Install Code from AL [DRAFT] Add Procedure ReinstallExtension to trigger Install Code from AL Dec 10, 2024
Copy link
Contributor

@nikolakukrika nikolakukrika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are against this change.
If we need to enable the data transfer or triggering upgrade on the same version this must be done via platform and we need to define the slices propperly.

@@ -405,5 +405,52 @@ codeunit 2500 "Extension Installation Impl"

exit(Result = PolicyToTestFor);
end;

procedure ReinstallExtension(PackageId: Guid; lcid: Integer; IsUIEnabled: Boolean): Boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not want to introduce this kind of trigger/functionality in the app. Re-running the upgrade code is dangerous, it can lead to data corruption.

If the version has not changed there must not be upgrade.

If there is a huge need to do this, we have platform capabilities to trigger the upgrade even if the version has not changed. We can trigger the upgrade in place, we are doing this for the cloud migration.

Alternative is to increase the version of the app and to publish that one.
Another alternative is that you can run the data transfer now if the cloud migration is enabled, so if you are running this code during the cloud migration, it can be run via an action from the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AL: System Application From Fork Pull request is coming from a fork Integration GitHub request for Integration area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BC Idea]: Trigger Upgrade Logic including DataTransfer from AL
3 participants