Hi all,
It seems that when you republish an extension from VSCode (CTRL +F5) all the data inside the tables of your extension is removed.
I've read all there is to read about upgrade codeunits but it does not seem that OnNavAppUpgradePerCompany and OnNavAppUpgradePerDatabase works yet for extensions (with the use of NAVAPP.RestoreArchiveData of course)?
Last update I could find about this can be found here:
https://github.com/Microsoft/AL/issues/62
Does anyone else have any information when we can expect this feature? If we can't upgrade our data then we can't republish any extensions (even if both publications are identical) which means we can't use extensions :-)
Thank you!
Regards from Mattias
Answers
If you deploy a new version of your .app file, and you run the proper powershell to deploy it (publish-navapp, then sync-navapp, then start-navappdataupgrade), the upgrade codeunit does run. I ran one myself this morning and it ran as expected. Here's a link that explains the process: https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-upgrading-extensions
RIS Plus, LLC
Thanks!
If you want the upgrade codeunit to run, you have to run it through powershell. Deploying your app from VSCode does not run the upgrade codeunit. It does run the Install codeunit though, so if you need some data setup you can put that there.
RIS Plus, LLC
RIS Plus, LLC
I wonder if they will put in a "Force"-property to not loose any data. We will see...
RIS Plus, LLC
In cases where you need to i.e. remove a field from a table, change the field type or such things, but want to keep the data. I get that you can use an upgrade codeunit for this, so it is possible to solve but that is what I mean.
Rgds from Mattias
RIS Plus, LLC
I want to remove a field without removing the data from the other fields I have added. I don't know if I can be any more clear than that...
Anyways, we will see what happens in the future, hopefully this scenario will be solved
RIS Plus, LLC
To be more precise:
I have 3 tables with 3 fields in each. First I publish them all, then I enter some information into the tables. Then I want to remove one of the fields in table no. 1. If I do this, then I will have to use recreate. This does not only mean that all data in table no. 1 will be removed, but also that the data in table 2 and 3 will be removed. In this case I would like to remove ONLY the field and the data stored in the field, but keep all other data intact.
Fortunately, this can now be handled with upgrade codeunits so it is not a big problem anymore, however I would still like to see a "force"-option to remove a field without all other data being removed.
Rgds from Mattias
if I understood correctly you found a solution how to delete 1 field from 1 table only and have not use "schemaUpdateMode"::Recreate option?
Could you help me (I tried to write upgrade codeunit (and install also) too, but no luck ) with information?
I checked MS-site and can't find answer too..
Thank you in advance for your help.
Yuriy Golyachuk, NAV Solutions Specialist & Developer
Skype: RedFoxUA