«

»

Jan 30

Dynamics NAV: check, if current installation is MultiTenant

I am currently working on a project, where I have to know, if the current installation is a multi tenant installation or not. There are different reasons why you might want to find this out, but in this case, I am actually generating code that then can be imported into the database – and obviously, I do not want to allow this for multi tenant installations.

I hope you find it useful, it works with all versions of NAV down to 2013 R2 (did not check on 2013 or 2009). There is a slight difference in each of the versions, I am going to note that below.

I created a function for this and it can easily be used anywhere in the system. First, we need to declare a .NET variable in this function and this is actually the one that needs to be changed based on what NAV version you are using. Here is the declaration

Name: ServerUserSettings
Type:  DotNet
Subtype: Microsoft.Dynamics.Nav.Types.ServerUserSettings.’Microsoft.Dynamics.Nav.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′

The “Version=” part needs to be replaced with the following:

  • 2017: Version=10.0.0.0
  • 2016: Version=9.0.0.0
  • 2015: Version=8.0.0.0
  • 2013 R2: Version=7.1.0.0

The actual code is only two lines:

 

It first instantiates the .NET Variable, which is actually part of every NAV deployment – it is a DLL Microsoft ships with NAV. The next part just determines, if the “Multitenant” ServerUserSettings property equals true.

That’s it. Can’t get easier than that.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">