Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

How to restore appdata while upgrade the NAV Extension Package ?

Posted on by 975

Hi Expert ,

I have created Extension package for NAV 2017 with the help of below urls
1) saurav-nav.blogspot.in/.../microsoft-dynamics-nav-2016-extensions_11.html
2) www.waldo.be/.../nav-extensions-updated-generic-data-migration-options

I have written one 'upgrade' normal Codeunit as below :
OnNavAppUpgradePerCompany()
RestoreFieldsInModifiedTables(33064461,33064499);
RestoreAppTables(33064461,33064499);


and use 1) NAVAPP.RESTOREARCHIVEDATA("Object ID",TRUE);
2) NAVAPP.RESTOREARCHIVEDATA("Object ID",TRUE);

I am able to installed and uninstalled successfully . While i am uninstalling our package extension ,table data backup also done in database as a a$AppData$f86b44d8 , $AppData$f86b44d8 ....... . Again i have installed our another extension version but backup data are not restored in our extension table. As per my understanding it should be restored data. Please give me an idea why it's not stored in our extension table.


Thanks
Surajit Kundu

*This post is locked for comments

  • surajitkundu Profile Picture
    surajitkundu 975 on at
    RE: How to restore appdata while upgrade the NAV Extension Package ?

    Thanks for your reply . I  will check and let you know.

  • Suggested answer
    Zaid Tariq Profile Picture
    Zaid Tariq 2,266 on at
    RE: How to restore appdata while upgrade the NAV Extension Package ?

    Hi,

    Can you try creating codeunit with just these two methods?

    OnNavAppUpgradePerDatabase()

    OnNavAppUpgradePerCompany()

    An in OnNavAppUpgradePerCompany() write

    NAVAPP.RESTOREARCHIVEDATA(YourTableNumber)

    Replace YourTableNumber with your table number.

    Thanks

  • surajitkundu Profile Picture
    surajitkundu 975 on at
    RE: How to restore appdata while upgrade the NAV Extension Package ?

    Hi Mohana,

        Please suggest what is the issue ?

    Thanks

    Surajit

  • surajitkundu Profile Picture
    surajitkundu 975 on at
    RE: How to restore appdata while upgrade the NAV Extension Package ?

    Hi Expert ,

      Please give me suggestion  what's the issue ?

    Thanks

    Surajit Kundu

  • surajitkundu Profile Picture
    surajitkundu 975 on at
    RE: How to restore appdata while upgrade the NAV Extension Package ?

    Hi Mohana ,

     I have written below code in 'Upgrade'  codeunit  :

    Documentation()

    OnRun()

    OnNavAppUpgradePerDatabase()

    OnNavAppUpgradePerCompany()

         RestoreFieldsInModifiedTables(33064461,33064499);

         RestoreAppTables(33064461,33064499);

    LOCAL RestoreFieldsInModifiedTables(FromField : Integer;ToField : Integer)

       WITH AllObj DO BEGIN

       SETRANGE("Object Type","Object Type"::Table);

      IF FINDSET THEN

       REPEAT

           Field.SETRANGE(TableNo, "Object ID");

           Field.SETRANGE("No.", FromField, ToField);

           IF NOT Field.ISEMPTY THEN BEGIN

             NAVAPP.RESTOREARCHIVEDATA("Object ID",TRUE);

           END;

       UNTIL NEXT < 1;

      END;

    LOCAL RestoreAppTables(FromTableID : Integer;ToTableID : Integer)

      WITH AllObj DO BEGIN

      SETRANGE("Object Type", "Object Type"::Table);

      SETRANGE("Object ID", FromTableID,ToTableID);

      IF FINDSET THEN

        REPEAT

          NAVAPP.RESTOREARCHIVEDATA("Object ID",TRUE);

        UNTIL NEXT < 1;

      END;

    Thanks

    Surajit Kundu

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: How to restore appdata while upgrade the NAV Extension Package ?

    can you show complete code.

    are you passing parameters to functions?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans