Yes, and this is by design as far as I know. The building of extensions from VS Code are only to be done to development databases, and not to test databases and never ever to live databases.
If you wish to keep the data, you should publish and install the generated extension in a different NAV database using Powershell.
If it is by design it makes the development process difficult.
For example when you need to debug a new codeunit you first would have to enter all the data in the new tables you have designed over and over again each time you would run the codeunit in debug mode.
That a bit unnecessary if you ask me.
Also upgrade logic isn't the place to make sure the data is saved or is it?
It's by design. When you hit F5, it re-creates the tables, and the data in the 'old' version is removed. It's the only way to be able to make destructive changes between two dev builds. Annoying when you want to keep some test data, but pretty logical if you think about it.
There's a setting in launch.json called "schemaUpdateMode". When this is set to 'recreate' (the default value) it recreates the table and you lose the data. Set it to 'Synchronize' and you get to keep the data.
Yeah maybe it's not yet available for the version that you are using, but that is in fact the setting that you need. I don't know of another way to keep the data when you re-build your workspace
Answers
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
If you wish to keep the data, you should publish and install the generated extension in a different NAV database using Powershell.
Check these pages:
https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-how-publish-and-install-an-extension-v2
https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-upgrading-extensions
Peter
https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-upgrading-extensions
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
If it is by design it makes the development process difficult.
For example when you need to debug a new codeunit you first would have to enter all the data in the new tables you have designed over and over again each time you would run the codeunit in debug mode.
That a bit unnecessary if you ask me.
Also upgrade logic isn't the place to make sure the data is saved or is it?
There's a setting in launch.json called "schemaUpdateMode". When this is set to 'recreate' (the default value) it recreates the table and you lose the data. Set it to 'Synchronize' and you get to keep the data.
You can create some test data by using an Install codeunit (https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-extension-install-code). Don't forget to get rid of the code in your published app, you don't want your test data in there .
RIS Plus, LLC
I've tried the schemaUpdateMode but that didn't work.
The message is "Property schemaUpdateMode is not allowed." if I add this to the launch.json.
I've found the link that describes the setting, https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-retaining-data-after-publishing, but it stil doesn't work.
Anyone tried this ?
so this is probably only on the devpreview builds of nav
RIS Plus, LLC
What version are you using?
https://github.com/Microsoft/AL/issues/1591
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav