Al: Preserve data

Created on 11 Jan 2017  路  14Comments  路  Source: microsoft/AL

When I press F5 after a previous build, I notice that I lost all data.

Do I have to foresee an upgrade-codeunit with the global functions as I had to in ExtensionsV1 as well?

enhancement shipped

Most helpful comment

Thanks.

Well, I would appriciate that the scope would be "preserve data" - even in development phase ;-).

All 14 comments

Currently it is not possible to use NavApp functions when developing extensions, but this whole feature is on our radar. No ETA yet.

well, apparently VSCode recognises it ..
image

but you say it doesn't work. So can I conclude there is no way to preserve data at this point?

Intellisense does recognize it, however you will get a compilation error once you complete the code. "The type or method 'RestoreArchiveData' cannot be used for 'Extension' development.'
At this point not all functions are allowed for extension development.
We are currently discussing the scope of this feature, I will get back to you on this thread.

Thanks.

Well, I would appriciate that the scope would be "preserve data" - even in development phase ;-).

Some progress on this? I can finish the code, it is compiled, but no data restored when I use
`
codeunit 70000000 UpgradeData
{
trigger OnRun();
begin
end;

procedure OnNavAppUpgradePerDatabase();
begin

end;
procedure OnNavAppUpgradePerCompany();
begin
    NavApp.RestoreArchiveData(70000000,false);
    NavApp.RestoreArchiveData(70000001,false);
    NavApp.RestoreArchiveData(70000003,false);       
end;

}`

This is still work in progress. We will update this thread once we have a solution proposal

Apparently, I can add those functions (OnNavAppUpgradePerCompany and OnNavAppUpgradePerDatabase) and apparently they also execute and inside of them I can write into the tables. However, when extension is uninstalled it simply deletes the data, rather than archiving the data.

Has anything changed here?

@StanislawStempin Will we get a similar feature as in the V1 extensions or will it be completely different?

I used some _initialization_ functionality next to the NAVAPP Restore functions in _OnNavAppUpgradePerCompany_. These don't work as well for now. Anyway I guess it's bad coding to do so at that place.

@StanislawStempin with NAV 2018 dropping on Friday, is there anything known on this issue?

We are currently working on it.

@StanislawStempin, do you have any timeline in mind? This becomes very critical for those folks that are planning to use VS Code as their primary dev environment for extensions on NAV2018. All workarounds to restore the data requires time to support that eliminate all efficiency we received with AL.

We are actively working on this but I don't think I'm allowed to promise you more than "very soon"

This feature has been implemented and you can read more about it here:
https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-retaining-data-after-publishing

Was this page helpful?
0 / 5 - 0 ratings