Al: How to use the NAVAPP Restore functions in OnNavAppUpgradePerCompany (??)

Created on 28 Nov 2018  路  2Comments  路  Source: microsoft/AL

Good day.

Sorry in advance for possible dublicate, but I can't find answer into the MS sites (I read https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-upgrading-extensions and "linked sites" like https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/navapp/navapp-restorearchivedata-method).
I found the page https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-upgrading-extensions, but can't find an answer on it.

The issue is (very simple situation):

  • I have a table with some fields and current installation has data already;
  • I'm using "schemaUpdateMode": "Synchronize";
  • I'm using VSC version 1.29.1
    I re-designed the solution a little and want to update (type or name) or delete 2 fields. When I tried to publish it I received that I can't publish it from VSC.
    I tried to use some initialization & upgrade codeunits with NAVAPP Restore functions in the OnNavAppUpgradePerCompany, but it does not work.
    It is not the real example, because I need to save data from the already installed and used version with data.

Where can I see the something (it is good to see an example of real code)? Please, don't write pages like https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/navapp/navapp-data-type because I checked it many times.

P.S. I read about "To write upgrade code for an extension" (https://docs.microsoft.com/en-us/dynamics-nav/extensions-upgrade-howto), but it is not the solution too

question

All 2 comments

NavApp Restore is a legacy function for upgrading from Extensions V1. You can simply reference the fields that you wish to upgrade in your upgrade codeunit and then run through an upgrade process. It is all described on the docs page that you already referenced: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-upgrading-extensions
If any steps don't work please log documentation bugs directly on that site.

OK. Looks like MS support don't want to answer on this question too ;)

Myabe I wrote not clear, but MY QUESTION was HOW TO write this codeunit with simple case:
"I have a table with some fields and current installation has data already;
I'm using "schemaUpdateMode": "Synchronize";
I'm using VSC version 1.29.1
I re-designed the solution a little and want to update (type or name) or delete 2 fields. When I tried to publish it I received that I can't publish it from VSC.
..
It is not the real example, because I need to save data from the already installed and used version with data."

Please, open this ticket again because I want to receive answer - HOW is it possible to receive answer??

P.S. I prepare this link (https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-upgrading-extensions) to you because explanation is NOT CLEAR and "example" from MS-site DOES NOT WORK!

Was this page helpful?
0 / 5 - 0 ratings