Skip to content
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

[Bug]: Action Populate From Extension in the Migration Table Mapping Page does not include Table Extensions from the Extension #579

Open
1 task done
finnpedersenkazes opened this issue Feb 14, 2024 · 3 comments
Assignees
Labels
Approved The issue is approved Bug Something isn't working

Comments

@finnpedersenkazes
Copy link

Describe the issue

Context: 1) Migrating a BC14 Company to the Cloud and 2) Including Customizations, that is, extra fields in standard tables and custom tables.

For custom data to be migrated to the cloud, you have to 1) make a corresponding App including, at least, the tables and table extensions and 2) specify a Migration Table Mapping.

To help creating the mapping, the user can run the action Populate From Extension in the Migration Table Mapping page.

However, and this is the issue, the Populate From Extension only includes the new tables and ignore the table extensions in the custom app.

Expected behavior

I expected the Action Populate From Extension in the Migration Table Mapping Page to include Table Extensions from the Extension.

Steps to reproduce

  1. In a standard BC14 OnPrem make a small customization, adding a field to the G/L Entry table and a new table called M/S Cust. Data. It is important with the special characters / and point. This will illustrate how difficult this part is. The special characters have to be converted to the underscore character.
  2. Populate the fields and tables with data.
  3. Create a cloud environment BC23
  4. Perform a migration to the cloud

In the last step make sure that the custom data are migrated and pay attention the custom data are migrated.

Additional context

Suggested Fix

Object in question:

\ALAppExtensions\Apps\W1\HybridBaseDeployment\app\src\pages\MigrationTableMapping.Page.al

Suggested Fix

I suggest the following change. I have replaced the SetRange with this SetFilter.

ApplicationObjectMetadata.SetFilter("Object Type", '%1|%2', ApplicationObjectMetadata."Object Type"::Table, ApplicationObjectMetadata."Object Type"::TableExtension);
            action(PopulateFromExtension)
            {
                ApplicationArea = All;
                Caption = 'Populate From Extension';
                ToolTip = 'Populate the list with all tables from an existing extension.';
                Image = ItemSubstitution;
                Promoted = true;
                PromotedOnly = true;
                PromotedCategory = Process;

                trigger OnAction()
                var
                    ExtensionTableMapping: Record "Migration Table Mapping";
                    PublishedApplication: Record "Published Application";
                    ApplicationObjectMetadata: Record "Application Object Metadata";
                    TableMetadata: Record "Table Metadata";
                begin
                    if not Rec.LookupApp(PublishedApplication) then
                        exit;

                    ApplicationObjectMetadata.SetRange("Package ID", PublishedApplication."Package ID");
                    ApplicationObjectMetadata.SetFilter("Object Type", '%1|%2', ApplicationObjectMetadata."Object Type"::Table, ApplicationObjectMetadata."Object Type"::TableExtension);
                    if ApplicationObjectMetadata.FindSet() then
                        repeat
                            if not ExtensionTableMapping.Get(PublishedApplication.ID, ApplicationObjectMetadata."Object ID") then
                                if TableMetadata.Get(ApplicationObjectMetadata."Object ID") then
                                    if TableMetadata.ReplicateData then begin
                                        ExtensionTableMapping.Init();
                                        ExtensionTableMapping.Validate("App ID", PublishedApplication.ID);
                                        ExtensionTableMapping.Validate("Table ID", ApplicationObjectMetadata."Object ID");
                                        ExtensionTableMapping.Insert(true);
                                    end;
                        until ApplicationObjectMetadata.Next() = 0
                    else
                        Message(NoTablesInExtensionMsg);
                end;
            }

Disclaimer

I have, for obvious reasons, not been able to test this fix.

I will provide a fix for a bug

  • I will provide a fix for a bug
@finnpedersenkazes finnpedersenkazes added the Bug Something isn't working label Feb 14, 2024
@JesperSchulz
Copy link
Contributor

Sounds fair, but I'd like to get an assessment from our migration expert @nikolakukrika.
Also, the code you would like to change isn't in this repository. It is in the https://github.com/microsoft/ALAppExtensions/ repo. If approved, I will move this issue to the right repo.

@JesperSchulz JesperSchulz added the Follow Up The issue has an open question and must be followed up on label Feb 20, 2024
@nikolakukrika
Copy link

I think it is an OK fix, but we should add a prompt. Usually table extensions are added manually, people want to control over this.

To avoid breaking anyone I would ask for the prompt dialog. It should populate should have options:
Tables
Tables and table extensions
(Maybe table extensions only but probably nobody will do this).

If you need this change, please make a PR.

@minaskats
Copy link

minaskats commented Feb 21, 2024

+1 We need the table extensions also . They are to many to add them manually.

@JesperSchulz JesperSchulz added Approved The issue is approved and removed Follow Up The issue has an open question and must be followed up on labels Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved The issue is approved Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants