Skip to content

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

Open
@finnpedersenkazes

Description

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

Metadata

Labels

ApprovedThe issue is approvedIntegrationGitHub request for Integration area

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions