Part 5: Upgrading to Dynamics NAV 2016
At the end of Part 4, the full upgrade from NAV 2009 R2 to NAV 2013 R2 was complete. It’s now time to upgrade from NAV 2013 R2 to NAV 2016. The steps here are similar to the previous upgrade in that you must convert the database, upgrade the code, then upgrade the data.
Upgrading to Dynamics NAV 2016 [NAV 2013 R2 -> NAV 2016]
Some things to consider before beginning the upgrade are the names of variables. If your current solution uses variables which are now used by a standard C/AL function (such as FOREACH), then those names must be changes, or must be enclosed in quotation marks. See the Changes in C/AL Behavior from Earlier Versions of NAV article for more information on which names should not be used. Another thing that should be considered are deprecated/redesigned functionality. You must verify that the upgrade codeunits (which you can find more information about in the Upgrade Codeunits article) migrate data correctly for the NAV 2016 upgrade. Lastly, company names that include special characters should be renamed as this might cause errors during the upgrade, they can be restored once the upgrade is complete.
Converting the Databases [NAV 2013 R2 -> NAV 2016]
For this upgrade, you must first upgrade the NAV 2013 R2 database first, and then the application, then data later. The first step is to back up the old database and then prepare to convert it. Do this by making a copy or creating a full database backup. You must then clear all NAV Server instance records from the dbo.Server Instance table in the database on SQL Server. This can be done by using SQL Server Management Studio to open and clear the table. Open the Development Environment and then connect to the old database, then verify that no objects are locked in the Object Designer. Open the Tools menu and choose Build Server Application Objects and then choose “Yes”. If errors occur, they will be shown in the Error List window and they must be addressed before continuing. Next, upload the NAV 2016 Partner Licence to the database. Since you are upgrading from NAV 2013 R2, you must run the Sync-NavTenant cmdlet from the NAV Administration Shell to synchronise the schema changes.
Now that the old database is prepared, the conversion can begin. You can now uninstall NAV 2013 R2 and then start the NAV 2016 installation. Run the setup and choose the Developer option. Once complete, open the NAV 2016 Development Environment and then connect to the database that was prepared earlier. Read the instructions that appear in the dialog box carefully, as this action cannot be reversed. Choose OK and then OK again to confirm that you want to convert the database.
Once conversion is finished, connect a NAV 2016 Server instance to the converted database by using the NAV Server Administration Tool. You must also add the service account used by the NAV Server instance as a member of the db_owner role in the NAV database on the SQL Server.
Run the Development Environment as an administrator and then set the development environment to use the NAV Server instance that connects to the database. Next, run the schema synchronization to complete the database conversion. Do this from the NAV Development Environment by going to Tools > “Sync. Schema For All Tables” > “With Validation” and then follow the synchronization instructions, or from the NAV 2016 Administration Shell by running the Sync-NavTenant cmdlet as follows:
Scyn-NavTenant –ServerInstance <ServerInstanceName>
If the database references assemblies not included on the NAV 2016 installation media, add the assemblies to the Add-ins folder on the NAV Server (C:\Program Files\Microsoft Dynamics NAV\90\Service\Add-ins) or NAV Windows client computers (C:\Program Files (x86)\Microsoft Dynamics NAV\90\RoleTailored Client\Add-ins folder). Go back to the Development Environment and go to Tools > “Build Server Application Objects” and then choose Yes.
The next step is to fix compilation errors. If they occur, they would show up in the Error List window. You can find a list of all objects that did not compile by setting a filter on the Object Designer in the Compiled field. Once complete, you must upload the customer licence to the converted database. This will complete the conversion of the NAV 2013 R2 database to be able to be accessed from NAV 2016. To test the database, you can connect it to the NAV 2016 Server instance and then opening a client.
Upgrading the Application Code [NAV 2013 R2 -> NAV 2016]
Since we’ve already upgraded the application code to NAV 2013 R2, the changes to NAV 2016 should not be too large. To upgrade the application code, you must merge code form different versions of the application, this is called a code upgrade and must be completed before the data is upgraded.
The process of upgrading application code is similar to the one during the initial NAV 2009 R2 -> NAV 2013 R2 conversion, except that there are now cmdlets that can make things faster. Please see the article provided by Microsoft regarding the upgrade from NAV 2013 R2 Application Code to NAV 2016, which contains an overview and a detailed guide on this upgrade process.
Upgrading the Data [NAV 2013 R2 -> NAV 2016]
Upgrading NAV 2013 R2 data to NAV 2016 compatible data is also similar to the previous data conversion from the NAV 2009 R2 version. Data conversion tools are provided with NAV 2016 to convert old data with the old version’s table and field structure so that in functions with the new version’s table and field structure. Please see the article provided by Microsoft regarding the data upgrade to NAV 2016, which contains a list of prerequisites and a detailed list of all steps required for the data upgrade. After the data has been upgraded, all three requirements for the NAV 2016 will be completed.
And that concludes our series on upgrading Dynamics NAV 2009 R2 to Dynamics NAV 2016!
If you found this series helpful and would like us to lead the upgrade of your company's system, don't hesitate to contact us.
 &  Upgrading to Microsoft Dynamics NAV 2016 - Upgrade Considerations
 Upgrade Codeunits
 Create a Full Database Backup (SQL Server)
 &  How to: Open Databases
 &  How to: Run the Sync-NAVTenant Cmdlet to Synchronize the Tenant Database with the Application Database
 How to: Connect a Microsoft Dynamics NAV Server Instance to a Database
 Provisioning the Microsoft Dynamics NAV Server Account
 How to: Change the Microsoft Dynamics NAV Server Instance
 Compilation Errors When Converting a Microsoft Dynamics NAV 2013 Database
 How to: Upload the License File
 Converting a Database
 Upgrading the Applications Code
 Upgrading the Data