Find Out if an Extension is Installed

EDIT: I’ve just been informed that users will not have access to the “NAV App Installed App” system table in the near future, so while the following will work for a typical NAV 2017 installation, it will not work for a Dynamics 365 extension.

EDIT2: I’ve posted a much better solution here!!

Having already created and published one extension, I am now in the process of creating a second extension, and in some cases, I want my extensions to act differently depending on if the other extension is installed or not. I could easily make each extension dependent on each other so that I know they’re always both installed, but where’s the fun in that!!??

You can do this by using the NAV App Installed App system table (2000000153). This table lists all of the extensions that are installed within the tenant.

Now, before I go further, I will mention that there is a function named IsInstalled in Codeunit 2500 (NavExtensionInstallationMgmt) that you could call, but this function accepts a Package ID, which is different than the Application ID of the extension. I prefer to use the Application ID, as I am in control of what that value is through the extension packaging process, and I like that control. So……because of this, I am not going to use the built-in function.

Here’s what you need to do:

First, create a local function that returns true/false depending on if a given Application ID is installed or not.

LOCAL CheckIfExtensionInstalled(AppID : GUID) : Boolean
EXIT(NAVAppInstalledApp.GET(AppID));

Next, we need to write local functions to return our extension Application IDs. You can get the GUID from the extension manifest file when you build the NAVX file. Repeat this process and create a function for each extension that you want to see if it’s installed.

LOCAL GetExtension1AppID() : GUID
//-- AppID: GUID
EVALUATE(AppID,'e7deb9a9-6727-4157-838e-bcf4a0853942');
EXIT(AppID);

Finally…….create a global function that will check for each extension. We will call this function from throughout our application wherever we need our application to act accordingly.

Extension1IsInstalled() : Boolean
EXIT(CheckIfExtensionInstalled(GetExtension1AppID));

Now, all we need to do is use the functionality in our code, such as the following example:

IF Extension1IsInstalled THEN BEGIN
  //-- do something
END ELSE BEGIN
  //-- do something else
END;

One thing to note, you will probably also need to give your codeunit (or whatever object you added the above functions to) permissions to read the NAV App Installed App table as the average user does not typically have this permission.

Advertisements

One thought on “Find Out if an Extension is Installed

  1. Pingback: Find Out if an Extension is Installed, part 2 | NAV Bits and Bytes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s