Not able to restore achive data using NAVAPP.RESTOREARCHIVEDATA(Tableid) in extensions for NAV 2017

Hello Experts,

I have created an extension for an addons . While testing in my local system I have found some bug so in order to fix that I have to uninstall the extension but I have stored some data in my custom table which I don't want to delete.

So in my upgrade codeunit where I have created one global function named OnNavAppUpgradePerCompany I have written below code

NAVAPP.RESTOREARCHIVEDATA(50001);
NAVAPP.RESTOREARCHIVEDATA(50002);
NAVAPP.RESTOREARCHIVEDATA(50003);

But when I have uninstalled that addons and again install that addons in my local machine I was not able to get my Archive data.

Please suggest me what should I need to do in order to fix that, I have followed below link but still not able to restore archive data.

msdn.microsoft.com/.../extensions-upgrade-howto

  • Hi Devesh,
    Have you checked in SQL that the data is actually there?
  • In reply to Erik P. Ernst:

    Hi Erik,

    Thanks for your response. As you mention, I have checked data in SQL and yes data is there. For your reference I have attached screen shot below. Do I need to write a code in OnNavAppUpgradePerDatabase function instead of OnNavAppUpgradePerCompany?

     

  • Hi All

    has anyone else encountered this issue? basically I create an extension, publish and install it (single tenant setup) if I uninstall then re-install the same version all data in custom tables/fields and backed up and restored exactly as expected. I can even totally unpublish and re-install the same version and everything works as expected.

    If however I perform an update to the extension and try to re-publish/re-install with a different version number (I.e. 1.0.0.1 - 1.0.0.2) the data is backed up correctly but the data IS NOT restored into the custom Tables/fields, the archive tables (dbo.$AppData$....) in SQL remain, I also don't get an error on install about schema changes not being handled in upgrade codeunit. I've tried various methods of including the upgrade code (own codeunit, in with existing codeunit, even tried Waldos generic example)

    does anyone have any ideas what the problem might be?
  • In reply to Garry Popplewell:

    Hi Gary,
    Did you maybe by mistake create a new manifest file for your 1.0.0.2 version (= new App ID guid) ?
    In that case NAV won't see it's the same extension application and will not restore archived data.
  • In reply to Jens Winberg:

    Hi Jens,

    Thanks very much for your reply, You are correct, i was creating a new manifest in memory and creating my package from that, using the syntax below I'm able to retrieve a manifest and change the version thereby preserving the App ID.  Many thanks for your assistance Jens, have a great weekend!

    Get-NAVAppManifest -Path '.\Manifest-Proseware SmartStuff.xml' | Set-NavAppManifest -Version 2.3.4.500 -CompatibilityId 2.0.0.0 | New-NavAppManifestFile -Path ".\Manifest-Proseware SmartStuff.xml" -Force
Related