Installing apps on Microsoft Dynamics NAV 2018

Overview

With Microsoft Dynamics NAV 2018 and Microsoft Dynamics 365 Business Central, extensions V2 (apps) have been introduced. These Microsoft Dynamics NAV apps are extensions to the base functionality, developed using the Modern Development Environment (Modern Dev) and the development language AL. Starting with Dynamics NAV 2018, we are releasing all our products as apps, unless technology prevents us from doing so. Modern Dev is still being enhanced and new events are introduced to Dynamics NAV and Business Central, which means that we will eventually be able to release all our products as apps.

Prerequisites

To be able to publish and install these Dynamics NAV apps, the standard Dynamics NAV service tier configuration has to be changed. The following settings have to be defined:

  • Allowed Extension Target Level: This  needs to be set to “Internal” as a minimum
  • Enable Loading Application Symbol References at Server Startup

You can find more details on the different service tier settings in the Microsoft Documentation here.

Symbols

If you are using a database that is based on the “Cronus” database, you can jump ahead, but for all other databases, please continue reading. Especially when upgrading from a previous version of Dynamics NAV to Dynamics NAV 2018, the “Cronus” database is not used. Which also means that symbols have not been generated for the base application yet. Symbols are the references for extensions that define every exposed function and field in every object. This is used at the time of publishing and installing an app to validate that the app can run.

Please read here to find out how to install symbols. The symbols can be found on the NAV DVD in the “ModernDev” folder. However, you only find the system (and test) symbols here. The system symbols represent all the system tables. You also need to generate the application symbols, which represent all Dynamics NAV objects in the database.

Generating Application Symbols

One time generation

You can generate the application symbols right before you publish new Dynamics NAV apps or upgrade apps to a new version. This can be done by the following command executed from the DOS prompt. Once you open a command prompt, change the current directory to the client folder (typically C:\Program Files (x86)\Microsoft Dynamics NAV\110\RoleTailored Client\). Then run the following command:

finsql.exe Command=generatesymbolreference, Database="[Database]", ServerName="[SQL Server]", [Credentials]
[Database] = Name of the Dynamics NAV Database

[SQL Server] = Name and instance of the SQL Server the database is on. This is in the format “ServerName\Instance” (“\Instance” can be left out, if the database is on the default instance)

[Credentials] = If you are using Windows Authentication to authenticate against the SQL Server, replace [Credentials] with “, ntauthentication=1”. Otherwise, you have to replace [Credentials] with “ntauthentication=0, username=[User], password=[Password]”

[User] = valid user name to authenticate against the SQL Server

[Password] = password for the user

Generate Symbols when compiling objects

If you make a lot of changes to the database, you can also change the way the development environment (C/SIDE) is started to automatically update symbols any time an object is compiled. You would have to update the shortcut for the development environment and add the following parameter: “generatesymbolreference=yes”

Publishing Dynamics NAV Apps

Before you can publish Dynamics NAV apps, please make sure that your database is synchronized. You can do that in the Administration PowerShell command window using the following command:

Sync-NAVTenant -ServerInstance [instance] [-Tenant [name]]
[instance] = name of the service tier

[-Tenant [name]] = if the installation is a multi tenant installation, you have to define the parameter “-Tenant” together with the name of the tenant. In single tenant installs, you can omit this parameter.

Publish App

To publish the app, you need to use the following PowerShell command (again from the Administration PowerShell console):

Publish-NAVApp -ServerInstance [instance] -Path [app path]
[app path] = Path including file name to the .app file

Synchronize Dynamics NAV Apps

After publishing the app, you will need to synchronize the app using the following PowerShell command:

Sync-NAVApp -ServerInstance [instance] -Name [name]
[name] = name of the app, for instance “NAV-X Credit Card”. You can always look at the installed apps to determine the name of the app by using the following PowerShell command:

Get-NAVAppInfo -ServerInstance [instance]

Install Dynamics NAV Apps

To install the Dynamics NAV app, please use the following PowerShell command:

Install-NAVApp -ServerInstance [instance] -Name [name]

Once you have performed these steps, you have the app installed and ready to use. If you encounter any errors, you first have to resolve these errors to continue.

Updating Dynamics NAV Apps to a new version

When a new version for a Dynamics NAV app is released, you will have to install this new version to be able to utilize the latest bug fixes and features. First you have to uninstall and unpublish your app and then republish the app.

Uninstall Dynamics NAV Apps

To uninstall your app, please use the PowerShell command below. No data will be lost, the data stays in the database. If this is a multi tenant environment, you will have to remove the app from all tenants.

Uninstall-NAVApp -ServerInstance [instance] -Name [name] [-Tenant [name]]

Unpublish Dynamics NAV Apps

After uninstalling the app, you will have to unpublish the app using this PowerShell command:

Unpublish-NAVApp -ServerInstance [instance] -Name [name]

Publishing new version of Dynamics NAV Apps

Now that you have removed the old version of the app, you now can publish the new version of the app:

Publish-NAVApp -ServerInstance [instance] -Path [app path]

Upgrading data

Before, when you installed the first version of the app, you used the “Install-NAVApp” command. Now that you already have a previously installed version of the app, you cannot install the app again – you will receive an error message. Instead of installing the app, you will need to upgrade the data using the following command:

Start-NAVAppDataUpgrade -ServerInstance [instance] -Name [name] [-Tenant [name]]

If this is a single tenant install, you can omit the tenant parameter. In a multi tenant installation, you need to perform the above command for each tenant.

Now that you have upgraded the data, the new version of the app is available and ready to use.

Leave a Reply