Data is not not synchronizing after re- published the extension to the sandbox..
Hello,
Data in field are related to extension is deleting after re-published the extension to the sandbox.
launch.json is update with "schemaUpdateMode": "Synchronize",
Also extension has data ugrade codeunit with folowing code. Can anyone please help on this
codeunit 70009607 "Data Upgrade Mgmt" {
trigger OnRun();
begin
end;
procedure OnNavAppUpgradePerDatabase();
begin
end;
procedure OnNavAppUpgradePerCompany();
begin
RestoreFieldsInModifiedTables(1, 99999);
RestoreAppTables(1, 99999);
end;
local procedure RestoreFieldsInModifiedTables(FromField: Integer; ToField: Integer);
var
"Field": Record 2000000041;
AllObj: Record 2000000038;
begin
WITH AllObj DO
BEGIN
SETRANGE("Object Type", "Object Type"::Table);
IF FINDSET THEN
REPEAT
Field.SETRANGE(TableNo, "Object ID");
Field.SETRANGE("No.", FromField, ToField);
IF NOT Field.ISEMPTY THEN BEGIN
NAVAPP.RESTOREARCHIVEDATA("Object ID");
END;
UNTIL NEXT < 1;
END;
end;
local procedure RestoreAppTables(FromTableID: Integer; ToTableID: Integer);
var
AllObj: Record 2000000038;
begin
WITH AllObj DO
BEGIN
SETRANGE("Object Type", "Object Type"::Table);
SETRANGE("Object ID", FromTableID, ToTableID);
IF FINDSET THEN
REPEAT
NAVAPP.RESTOREARCHIVEDATA("Object ID");
UNTIL NEXT < 1;
END;
end;
}
Are you upgrading from Extension V1 to Extension V2? The NavApp.RestoreArchiveData should only be used if you have archive tables that get created when an Extension V1 is uninstalled.
If you're testing purely Extension V2 then there is no need for the upgrade code to preserve your data on subsequent republishes.
Also note that the Cloud Sandbox (as opposed to Container Sandbox available through Docker containers) is not yet updated to the build that contains the schemaUpdateMode feature. Which sandbox are you using and which version of the AL Language extension?
Hi StanislawStempin,
Currently we are not upgrading the extension V1 to V2. Only testing with the Extension V2
we were using the cloud sandbox (Not sure with the version). To have the "schemaUpdateMode": "Synchronize" option what need to be done with the sandbox.
And the AL langauge extension version is 0.12.15359
Could you please retry this on the latest version? Please Reset your cloud sandbox to make sure it gets reprovisioned on the latest codebase and use AL Language version 0.15
It worked for me. Thanks