Microsoft Dynamics NAV

Team Blog

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 9 for Microsoft Dynamics NAV 2015 has been released


    Cumulative Update 9 includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2015. 

     The cumulative update includes hotfixes that apply to all countries and hotfixes specific to the following local versions:

    •   AU - Australia
    •   AT - Austria
    •   BE - Belgium
    •   CH – Switzerland
    •   CZ – Czech Republic
    •   DE - Germany
    •   DK - Denmark
    •   ES - Spain
    •   FI  - Finland
    •   FR - France
    •   IS - Iceland
    •   IT - Italy
    •   NA - North America
    •   NL - Netherlands
    •   NO - Norway
    •   NZ - New Zealand
    •   RU – Russia
    •   SE - Sweden
    •   UK - United Kingdom

    Note: You must convert the database if you are upgrading to this cumulative update from a cumulative update earlier than Cumulative Update 9 (build 41779). For more information, see Converting a Database in Help for Microsoft Dynamics NAV. 

    Note: To enable customized translation of profiles, a number of actions are now available on the Profile List page. You can export and import resource files to enable translation for one or more profiles. The steps to install and uninstall language modules have also been modified. For more information, see How to: Install Language Modules, How to: Uninstall Language Modules, and How to: Export, Edit, and Import Translated Profile Strings in Help for Microsoft Dynamics NAV.  

    Where to find Cumulative Update 9

    You can download the cumulative update from KB 3075726 – Cumulative Update 9 for Microsoft Dynamics NAV 2015 (Build 41779). 

    Additional Information

    For information about how to install the cumulative update, see How to Install a Microsoft Dynamics NAV 2015 Cumulative Update

    For information about how to work around a recent process change, see How to Get Back the 'Hotfix Directories' from NAV 2015 Cumulative Update 1.

    For a list of all cumulative updates for this version, see Released Cumulative Updates for Microsoft Dynamics NAV 2015.  

  • Microsoft Dynamics NAV Team Blog

    Coffee Break - Monitoring and Troubleshooting Services Part 2


    In this post, we thought we might look into how to use Windows PowerShell to work with XML data. As a user scenario, we are continuing here on our previous post, to look further into server troubleshooting possibilities.

    You might experience an error, warning, behavior that you want to analyze, but have no clear repro scenario for. Troubleshooting these scenarios normally starts with messages logged in the Application Log, and in the previous post we talked about how to check the application log using PowerShell.

    However, you’ll often find that the application log contains insufficient or no details about the problem you’re analyzing.  In these cases, you can trace overall service activity to find the root cause of the behavior you’re looking into. Or the issue might affect one client only, in which case you will want to trace that client (be it Windows client or Web client), to find the cause of the problem. The best option here is to use Windows Communication Framework (WCF) tracing.

    You can enable WCF message logging in the config file for the Dynamics NAV Server instance sothe messages processed by the service are logged. Message logging can be used to diagnose your applications and analyze the root cause of problems. Message logging is not turned on by default; turn on message logging by setting attributes on the <messagelogging> element in your configuration file and then add a trace listener to log the events to a file.

    Similarly, you can enable WCF tracing (in the service config file) to help debug your WCF service by logging all operations on your service.

    You can find more details on different tracing options here, and more details related to tracing on Dynamics NAV here. Here you will find a list of settings we will be adding to server config file to enable tracing.

    Coffee Break 15 - Using Windows PowerShell to enable WCF message logging and tracing on Dynamics NAV Server

    We’ll start by modifying the server config file to add these settings. You can modify your service/client config file by using the WCF Service Configuration Editor. However, as these posts are all about automation, we will naturally look into how to do this using PowerShell.

    There are probably more than one ways to do this, but for this example we have chosen XMLDOM. The service config file is an xml file, so we’ll be using XMLDOM to enable tracing in the config file. To upload an XML-formatted text file as to Powershell XML, all you need to do is strong type it as XML.


    $xml = [xml](Get-Content D:\Microsoft.Dynamics.Nav.Server.exe.config)

    Once tracing is enabled, trace and message logs will be stored at the location that you specify:

    $LogFolder = 'c:\Logs'

    if (!(Test-Path -Path $LogFolder)) {new-Item -path $LogFolder -ItemType directory} 


    #provide server config file name

    $Filename = 'Microsoft.Dynamics.Nav.Server.exe.config'


    #provide full path and name of the config file 

    $ConfigPath = (Get-ItemProperty  'HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\80\Service')


    #Upload config as xml document

    [xml]$blobxml = Get-Content -Path  (join-path ($ConfigPath).Path  "\$Filename" ).ToString()


    To see all methods and properties of the XML object, run

    Get-Member -InputObject $blobxml


    To check the childnodes of the document, use



    To create a node, use

    $elem = $blobxml.CreateNode('element',<node name>,'') 


    To append the node:



    For full reference to XMLDOM class, methods and properties, see the MSDN Library.

    The complete example of enabling WCF tracing using PowerShell is attached to this post (ServiceTracing_PS.ps1).

    Note that the example adds the following tracing configuration:

    MessageLogging,  switchValue="Warning, ActivityTracing"

    Tracing, switchValue="Verbose,ActivityTracing"


    wmiProviderEnabled= "true"









    These should be adjusted as needed (see tracing options).

    Once the config file is modified, you must restart the service for tracing to start. Logs will be generated at the specified location (in our example c:\Logs).


    After you have captured the event, you should turn off the tracing. One can either replace the modified .config file with the original one (that will remove tracing configuration), or modify the relevant settings (using PowerShell, of course) to turn off the tracing.

    Settings to modify to turn off tracing (following the example above) are :


    MessageLogging,  switchValue=" "

    Tracing, switchValue=" "


    wmiProviderEnabled= "false"









    Tracing will stop once the service is restarted using the above configuration (or original config file).

    An example of a script to turn the tracing off is also attached to the post (Stop_Server_Tracing.ps1).


    Run the above scripts remotely on your customer’s server to trace the customer’s service (on premises or in the cloud) to enable /disable server tracing and messaging.

    Happy troubleshooting!


    Jasminka Thunes, Escalation Engineer Dynamics NAV EMEA

    Lars Lohndorf-Larsen, Escalation Engineer Dynamics NAV EMEA

    Bas Graaf, Senior Software Engineer Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Coffee Break - Monitoring and troubleshooting NAV Services


    Windows PowerShell is very well suited for monitoring services because tasks can be repeated and they can run remotely. In this post we will look at how to check the Application Log via Windows PowerShell, locally as well as remotely, to look for errors or for certain words in the log. The customer story this time is that users report a problem and you need to find the cause. The first place to look (at least in some cases): the Application Log.

    In future posts we will look at tracing the service tier/client activity using powershell and WCF, and other ways to monitor and troubleshoot. As always, comments are welcome if there are any particular things you would like to see.

    Coffee Break 14 - Using Windows PowerShell to check and search the Application Log.

    There are two main ways to get the Application Log with PowerShell:

    • Get-EventLog
    • Get-WinEvent

    For more details on this (and which one to use), check this post on the Goatee PFE blog. In short: Get-EventLog is the simple way. Get-WinEvent is the more flexible way. Here, we will use Get-WinEvent.

    Get the Application Log

    Get-WinEvent -LogName Application -MaxEvents 100

    or read it from a saved log:

    Get-WinEvent -Path "c:\Temp\MySavedLog.evtx" -MaxEvents100

    or from a remote machine:

    Get-WinEvent -MaxEvents 100 -ComputerName MySvr2012

    or from a list of remote machines:


    foreach($Server in $Servers) {$Server ;Get-WinEvent -logname Application -MaxEvents 100 -ComputerName $Server}

    Look for providers

    One of the advantages of Get-WinEvent, is that it filters on source, and only transfers the filtered events back when retrieving events from a remote machine. In the Application Log, Provider = Source. When we are just looking for Dynamics NAV events, then filter on Dynamics NAV. First find the provider / source:

    Get-WinEvent -ListProvider *nav* | Format-Table

    Then filter on Dynamics NAV, whether the service you want to check is NAS, Web Service, Dynamics NAV Server, or any other service. For this example let's use "MicrosoftDynamicsNavServer$DynamicsNAV80"

    Get-WinEvent -ProviderName "MicrosoftDynamicsNavServer`$DynamicsNAV80"

    Notice the escape character  ` before the $-sign to tell PowerShell that we want the $-sign, and are not referring to a variable.

     Use FitlerHashTable for filters

    Once we start adding multiple filters to Get-WinEvent, we need to provide them as Key-Value pairs. The supported values for filtering is listed here: Supported Filter Values:

    • LogName <String>
    • ProviderName <String>
    • Path <String>
    • Keywords <Long>
    • ID <Int32>
    • Level <Int32>
    • StartTime <DateTime>
    • EndTime <DataTime>
    • UserID <SID>
    • Data <String>
    • * <String>

    The syntax is:

    Example: Look for Application Log entries from Dynamics NAV:

    Get-WinEvent -FilterHashtable @{LogName = "Application"; ProviderName = "MicrosoftDynamicsNavServer`$DynamicsNAV80"}


    Useful filters:

    Find error logs: Filter on Level = 2 (Level 4 is Information)

    Date Filters: $MyDate = Get-Date / (Get-Date).AddDays(-2)

    Example: Find Error logs from Dynamics NAV for the last week:


    $BeginDate= (Get-Date).AddDays(-7

    Get-WinEvent -FilterHashtable @{LogName = "Application"; ProviderName = "MicrosoftDynamicsNavServer`$DynamicsNAV80" ; StartTime = $BeginDate; EndTime = $EndDate ; Level =2} 

    And Remotely

    Invoke-Command -ComputerName MySvr2012 -ScriptBlock {Get-WinEvent -FilterHashtable @{LogName = "Application" ; ProviderName = "MicrosoftDynamicsNavServer`$DynamicsNAV80" ; level = 2}}

    More details about remoting PowerShell with Dynamics NAV here.

    Find specific events

    Find a specific event in the Application Log:

    $pattern = "NAS Startup Parameter"#or

    $pattern = "The service has registered service principal names "#or

    $pattern = "Deadlock"#or

    $pattern = "System.InvalidCastException"#or

    $pattern = "Server instance: DynamicsNAV80"#or

    $pattern = "listening to requests at net.tcp"#... etc

    Get-WinEvent -FilterHashtable @{LogName = "Application" ; ProviderName = "MicrosoftDynamicsNavServer`$DynamicsNAV80"} | where {$_.Message.Contains($pattern)} | foreach {"$($_.Message) `n-------`n"}

    Printing details

    You may have noticed that the examples above only print the first few characters of each event. To get the full event (but also mess up your screen), simply format as list:

    Get-WinEvent -FilterHashtable @{LogName = "Application" ; ProviderName = "MicrosoftDynamicsNavServer`$DynamicsNAV80"} | Format-List

    or keep it in table format but wrap each line:

    Get-WinEvent -FilterHashtable @{LogName = "Application" ; ProviderName = "MicrosoftDynamicsNavServer`$DynamicsNAV80"} | Format-Table -AutoSize -Wrap

    or control the output via a variable:

    $Events=  Get-WinEvent -FilterHashtable @{LogName = "Application" ; ProviderName = "MicrosoftDynamicsNavServer`$DynamicsNAV80"}





    Jasminka Thunes, Escalation Engineer Dynamics NAV EMEA

    Lars Lohndorf-Larsen, Escalation Engineer Dynamics NAV EMEA

    Bas Graaf, Senior Software Engineer Dynamics NAV



  • Microsoft Dynamics NAV Team Blog

    New Application Design Patterns: Totals and Discounts on Subpages


    To increase discoverability and productivity, critical information, such as statistics, can be moved from separate pages onto the document where it is needed. For example, documents should clearly display totals and discounts information to provide quick overview, make it easy to relate the amounts to the document currency, and to allow the user to see and apply discounts directly on the document.


    Before Microsoft Dynamics NAV 2015, totals and discount information was scattered between the document and the Statistics page, which made it less discover-able and less usable for new users. It was difficult to see the discount amounts, relate the amounts to the currency of the invoice, and it was not-intuitive that you had to update the Statistics page to see updates on the document. In addition, the result of the update was not visible on the main document, which added to the confusion.

    Totals and discount information logically belongs on the document, as is the case in many competitor products.

    The Statistics page contains too much information for most common scenarios, and only a part of the information is visible on the related document. See the following example for sales order statistics.

    With the pattern implemented, selected statistics fields are placed on the sales order, as in the following example.

    This new layout gives precise and complete information about totals and discounts, with discounts on the left side and totals on the right side. The currency is clearly shown, and the layout resembles a printed document. The values are always updated (with some exceptions that are explained in the next following sections), and the user can apply a discount directly on the document.

    Read more on the NAV Design Patterns wiki...

    By Nikola Kukrika at Microsoft Development Center Copenhagen

  • Microsoft Dynamics NAV Team Blog

    Best Practices Tips and Tricks for Upgrading to Dynamics NAV 2013 R2 or Dynamics NAV 2015 Part 2


    In an earlier blog post, we started to mention some tips and tricks to help you plan your upgrade to a newer version of Microsoft Dynamics NAV . In this post, we would like to share with you some of the known issues we stumbled over in the past couple of months or years, and what can you do in case you get into any of these known situations.

    Today, it's mainly not about the solutions we give; sometimes it works at first try, sometimes you need to take another approach. We want to highlight how you should think about the different situations you get into, and what you should  check for. So, based on our experience, we list here some of the main points that you need to understand carefully while facing some issues during your upgrade.

    Synchronization Issues

    As you know, with Microsoft Dynamics NAV 2013 R2 , we introduced a number of changes to the product comapared to Dynamics NAV 2013 with the new support for multitenant deployments. You can read something about that here:

    Based on this new architecture, compiling and synchronizing objects to SQL Server becomes more sophisticated than before. A well-known issue is that when you upgrade to Dynamics NAV 2013 R2 / NAV 2015 and open the Windows client for the first time, you would not be able to start the client and you would get the following error:
    ‘Invalid Column name’ or ‘column xxx already exist’ or ‘Column xxx does not exist’.

    To explain this in a better way, we published an explanation of the new design and how to work on it to avoid having this error:

    Read that blog post before you start on step 11 in the upgrade from Dynamics NAV 2009 SP1/R2 to Dynamics NAV 2013 R2 , or step 7 in the upgrade from Dynamics NAV 2009 SP1/R2 to Dynamics NAV 2015. At that point, you are getting ready to import an .FOB file with all your objects. Based on the size of the database and the amount of customizations, you might want to export the objects to more to than one .FOB file so that you import the objects in a couple of separate rounds to simplify the first synchronization process. Here are the steps to follow:

    1. Start with a clean database in case you already had sync errors, restored the backup before you tried to start the Windows client.
    2. Always work on the latest build possible because we regularly solve lots of issues related to sync on later builds. Proceeding with an older build of Dynamics NAV is not recommended. See following links to identify the latest build for your version of Dynamics NAV:
    3. When you know the KB number (i.e. cumulative update ID number from the above sites) for the build you want, you can use the following link to request the build from Microsoft (just replace the KB number kbnum in the URL):

    4. Go to the configuration of the service and change ‘SQLCommandTimeout’ to a big value such as 10 hours. The default is 30 minutes, which is too small a window.

      Also do not forget to check if your remote query timeout (s) parameter in your SQL Server (In case it was changed before to any very low value).

    5. Restart the service.
    6. Import the .FOB with all your objects.

      If the .FOB file contains too many objects, you can create one .FOB file with table objects and another .FOB file with the rest of the objects. You would then import first the tables .FOB and synchronize the database schema, and then you import the second .FOB and sync. Alternatively, simply do not import all objects at once.

    7. Make sure all objects are compiled on whatever build number you are using.
    8. Do no start the Windows client (RTC) as this could cause a synchronization problem. Also, in Dynamics NAV 2015, do not start the sync inside the development client (although it is available). We recommend running the first sync ever using the PowerShell command Sync-NAVTenant:
      1. Go to start menu, search for Start ‘Power Shell ISE ‘as this is preferable to the Dynamics NAV Administration Shell for this purpose. Always run the ISE as administrator.
      2. Run the below command to avoid restrictions:

        Set-ExecutionPolicy Unrestricted

        A message will show up, confirm by pressing Yes.

      3. Run the following command to import the Dynamics NAV administration tools (amend path if necessary):

        Import-Module "C:\Program Files\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1"

      4. Run the Sync command ‘Sync-NAVTenant’ for the relevant instance. For Dynamics NAV 2015, see following resources for more parameter you can use for the sync:

        .. or run following command in PowerShell: get-help Sync-NAVTenant -online

      5. Let it run as long as it takes and do not try to interrupt it even if it takes hours long, till either PowerShell is ready for another command again, which means the sync did run properly, which means you can start your Windows client without issues, then carry on following the upgrade blog, or the upgrade document for Dynamics NAV 2015.

        In case the upgrade is to Dynamics NAV 2015, it is much easier, because it includes a status bar to show you the progress of the sync.

      6. If any errors occur, it will be written in PowerShell, check please the event viewer of the service tier again, for Dynamics NAV 2015 you can always run the command:

        Get-NAVDataUpgrade InstanceName -ErrorOnly

    Having all the above information in mind should make you fit in case of having sync. Issues while upgrading to avoid any unpleasant surprises.

    Time estimated for the sync process, is always related to the amount of objects synchronized at once vs the amount of resources you do have on your SQL Server, note that you can be having lots of resources on the SQL Server machine, but you might have not configured it properly to get full use of these resources.

    Collation Issues

    Before we start keep in mind that starting from Dynamics NAV 2013, the supported collations are only Windows collations, and this is for better support to the Unicode compatibility, so if you had a database on older version using SQL Collation, it will be changed automatically while upgrading. This can have an Impact on the Upgrade and can cause some known errors:

    • Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object.
    • It might be not really duplicate, but because the windows collation cannot interpret all characters that the SQL Collation could interpret, it might seem to be the same.
    • Here you have to make sure that all your primary keys are not depending on the used SQL Collation in older version.

    Another type of error, while trying to start step 2 to convert data is:

    • SQL error during migration, usually in the following form:

      The following SQL error is not expected

      The data type nvarchar cannot be used as an operand to the UNION, INTERSECT or EXCEPT operators because it is not comparable.

      Statement(s) could not be prepared.

      This type of errors can occur if depends on whether you are using case sensitive or case insensitive collation, and if you have objects having different collations than other objects.

      Usually it occurs in similar statements like the one below:

      declare @p1 intset @p1=-1exec sp_prepexec @p1 output,N'@0 nvarchar(1),@1 nvarchar(1),@2 nvarchar(1),@3 nvarchar(1),@4 nvarchar(1),@5 nvarchar(1),@6 nvarchar(1),@7 nvarchar(1),@8 nvarchar(1),@9 nvarchar(30),@10 int',N'SELECT TOP 1 * FROM (    SELECT     CAST (0 AS timestamp) AS [Timestamp],        [Company Name],        [ID] AS [Table No_],        [Name] AS [Table Name],        CAST (CASE WHEN [Row Count] > 2147483647 THEN -1 ELSE [Row Count] END AS int) AS [No_ of Records],        CASE [Row Count] WHEN 0 THEN 0.0 ELSE [Size] * 1024.0 / [Row Count] END AS [Record Size],        CAST (CASE WHEN [Size] > 2147483647 THEN -1 ELSE [Size] END AS int) AS [Size (KB)] FROM (  SELECT            [Company Name],            [ID],            [Name],            SUM(row_count) AS [Row Count],            SUM(reserved_page_count) * 8 AS [Size]  FROM (   SELECT    C.[Name] AS [Company Name],    O.[Object ID] AS [ID],    O.[Name],    C.[Name] + ''$'' + O.[Name] AS [Company Qualified Name]   FROM [Sprügel].[dbo].[Object Metadata Snapshot] AS O   CROSS JOIN [Sprügel].[dbo].[Company] AS C   WHERE O.[Data Per Company] = 1 AND O.[Object Type] = 1   UNION   SELECT    '''' AS [Company Name],    O.[Object ID] AS [ID],    O.[Name],    O.[Name] AS [Company Qualified Name]   FROM [Sprügel].[dbo].[Object Metadata Snapshot] AS O   WHERE O.[Data Per Company] = 0 AND O.[Object Type] = 1        ) AS [O]        INNER LOOP JOIN [Sprügel].[sys].[dm_db_partition_stats]                ON object_id = OBJECT_ID(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE([Company Qualified Name], @1, @0), @2, @0), @3, @0), @4, @0), @5, @0), @6, @0), @7, @0), @8, @0)) AND (index_id < 2 OR index_id = 255)  GROUP BY [Company Name], [ID], [Name]    ) AS [Core Query]) AS [Projected Query] WHERE ("Company Name"=@9 AND "Table No_"=@10) ORDER BY "Company Name" ASC,"Table No_" ASC',@0=N'_',@1=N'.',@2=N'"',@3=N'\',@4=N'/',@5=N'''',@6=N'%',@7=N']',@8=N'[',@9=N'',@10=0select @p1

      This Union here is causing the issue based on the used collation because it is not matching what SQL server expects.

    • Usually changing the collation solves the situation, as mentioned here:

      But you have to be careful while doing it manually.

    It would be also good to understand what does the collation change exactly do, especially if you are changing the collation of a huge database:

    • The collation change process is simply running through every character based NAV field in the DB and issuing the following statement:

      ALTER TABLE "<table name>" ALTER COLUMN "<column name>" VARCHAR(xx) NOT NULL

    • And this involves every character field in every table, so especially for huge database, you need to plan the time for this properly, in the section related to Performance we will be back to this in more details.
    • In case of flow fields, in the conversion process to Unicode, The conversion is going through all these records and set the BLOB fields to NULL value.

      (Loop cursor type of data upgrade), and after it finishes, the data would be returned, as you would be saved temporarily.

    • So the more FlowFields you have, the more performance issues you might experience.

    In huge databases, it is always recommended to do the change collation as a separate step in Dynamics NAV 2009 Classic Client before you even start the upgrade.

    • This will give you more control on the collation change yourself.
    • You can see if it works well, or if you might need to change the collation of some objects manually on SQL Server.
    • You can see if the database has performance issues or not, and if it is related to the collation change, or rather to the Unicode conversion.

    If you change the collation for a Dynamics NAV database using the NAV Development environment on versions 2013 R2 or later you might notice some subtle differences compared to earlier versions. See the following blog for more details:

    Data Conversion Issues

    Data conversion is a very sophisticated process, and takes into consideration lots of are factors like the design of the tables and the relations of these tables so as the integrity of the indexes and the collation before working on converting the data itself.

    If you have customizations that do not take care of all these dependencies you might get an issue while converting the data.

    Let us look at an example:

    • It can happen that when the conversion starts conversion of object metadata the following error is received: The following ODBC error occurred: Error: [Microsoft][SQL Server Native Client 10.0] Unspecified error occurred on SQL Server. Connection may have been terminated by the server. State ID: HY000.
    • The main reason here might be some tables / any other objects in the database that do not compile because of some functions that are missing in the tables, or that do not maintain the design or the structure of other objects. For example when changes have been made to the tables directly in SQL.
    • Here again we mention that the database on the original version before the upgrade has to be checked to avoid these issues.
    • For a possible workaround here make a NAV backup of the NAV 2009 database and restore the backup into a new database and you will be able to convert the database.

    Another example is a typically known error:

    • The supplied Field name ‘’ does not exist in the ‘’ table.
    • Some fields like field number 1300 in table 112 are automatically added while running step number 11 in the upgrade ‘see the blog mentioned above’.
    • In some cases if an Issue causes this field, or any other fields not to be created, the data conversion will not run and will look for these fields and return errors.
    • Carry on the step again and make sure that the fields are added and synchronized to SQL properly as explained in the previous points.

    Error Code 85132273 in Dynamics NAV 2013 R2

    While upgrading and in some steps while compiling either system tables or customized tables, you can get an error such as this one:

    • ERROR CODE : 85132273
      • This error code is a PRIMARY KEY violation. This occurs due to different reasons, it can be that on the older versions there were some special characters in the primary keys. In this case, looking for the key causing the issue and correcting it might be the best way.
      • Starting from Update Rollup 9 this error code has been handled to show friendlier message to point to where the error is. It can be that the names of some fields in table are depending on some other ones that are not synchronized yet. To work against this, we wrote another blog post with more info that can help against this:
      • Sometimes the same error can be because of not having the system tables compiled before imported the new fob. 

    However, sometimes you get another error, even though you have synchronized all objects :

    Table Index Issues

    As we mentioned before the upgrade procedure takes many factors into consideration. One of these factors is the indexes for the tables.

    • It is often the case that while working on the upgrade you cannot go further because of the following:
        • Wrong or missing indexes.
        • Indexes that show up as null indexes.
        • Indexes that are amended manually.
      • The best way to figure this out the database check tool.
      • In KB 2963997 you find the data base check tool where you can check the database for any internal metadata inconsistencies in the Dynamics NAV database.  We recommend running the command line tool and routing the output to a text file. You can then search the text file for any occurrences of “Error:” as this is the prefix used for any error messages. 
    • In some other cases the Null indexes are coming from older bugs in older versions.
      An example of this is as following:
      • After upgrade from Dynamics NAV 2013 R2 Rollup 2 to Rollup 6 you get this error - which was coming with Rollup 5 and should be solved with Rollup 6!
      • "The server [server name] was unable to process the request. Close the application and start it again" error message when you start the Windows client after converting the database to build 36281.
      • System.Data.SqlTypes.SqlNullValueException

        Message: the value of the SQL Server index cannot be null.

      • A good workaround for this would be by restoring a .fbk backup on another newly created database.
    • In some other example the statistics of some tables can have no index.
    • The tool mentioned above will help you finding it out.
    • Deleting this statistics would resolved this, because you are not allowed to have a statistic with a missing index.

    Upgrade Performance

    The performance of the upgrade might vary based on the size of the database and the size of the customizations,  During the upgrade, there are 3 procedures that might be the bottleneck especially while upgrading huge databases:

    • Changing the collation to windows collation while opening the database the first time with the NAV 2013 Windows client.
    • The Unicode conversion step.
    • While Importing FOB the first time in NAV 2013 R2 / NAV 2015.
    • While Synchronize the Imported FOB.
    • While transferring the Data in NAV 2013 R2 / NAV 2015. 

    Of course depending on the situation of the database, make sure before you start upgrading that you had maintenance plans running on the older database, and that all indexes and statistics are updated gradually  so that the database does not have a general performance issue

    • Check if the database is not having any issue, simply by running dbcc checkdb against the database in SQL server.
    • Fob Importing might take a lot of times for huge FOBs, here we have issued more than one hot fix to help against this, be sure you are on latest build (see point #2 on page 14 of this document for details about how to access the latest build for your version of Dynamics NAV
    • In case the number of customizations is big and the database is huge, do not import one fob with all Objects, divide the FOB into more than one package as mentioned previously in this document.
    • Take care you are running the upgrade on a adequately resourced SQL Machine that is properly configured to get the use of all possible resources (there is more than one sql configuration document for Dynamics NAV on Partner source).
    • Be aware that if the SQL Machine is too weak, and the process of the first sync would take more than 6 hours, it is likely that SQL server will reject the process with a timeout.
    • In case any sync process did not run till the end, be sure that a rollback will be running, do not re-try to run the sync or worse to restart the service before it finishes.
    • You can monitor such a rollback with the following command:
      • select percent_complete, * from sys.dm_exec_requests  
    • The time of the import and the sync is highly depending on the number of companies in the database, so if you have any unused companies, or demo companies inside the database, we highly advise to remove it before starting the upgrade.
    • Some partner do run the upgrade only on one company, and then later on create the other companies and use some own customized SQL Query from other upgraded databases containing the data ‘a database for each company for upgrade sake’, it might sound complicated, but it runs much faster than having it all in one box.
    • Remove any unneeded companies from the database to avoid any unnecessary overhead.
    • Remove any unneeded flow fields, as we said before while changing the collation NAV works on every flow field on its own.
    • Make sure there is plenty of SQL Server log space available as the upgrade process can be very demanding on log space. You can reduce the SQL log size for the NAV database after the upgrade process is complete.
    • For huge databases, we suggest running the change collation as a separate step in 2009.
    • In that case, I would even try to change the collation of the top 5 or top 10 tables manually on SQL Server .‘The tables having most records, especially if we are talking about more than 10 million records per table’.
    • Get rid of all not needed indexes, scan especially the huge tables, and remove any unneeded ‘maintainsqlIndex’.
    • Make sure you are running on a well configured SQL Server with enough resources, if you are not sure, communicate with Microsoft support to ask for their opinion about your configuration.

    System Tables with Non-English Names

    In the oldest versions of Dynamics NAV, you could translate the columns in system tables to a language other than English. Starting with version 3.0, we adviced heavily against this, and versions later than Dynamics NAV 2013 R2 require that all columns in all system tables are in English. As a result, if you try to open a database with non-English system tables in Dynamics NAV 2013 R2  or Dynamics NAV 2015, you will see an error, saying that one or more columns do not exist. 

    if you are upgrading a database where the system tables are translated, do the following:

    • Make sure you use the right version of the .ETX and .STX files.
    • Make sure that all objects where compiled in a development environment with the right .ETX and .STX files.

    You can verify that you are running in the correct environment with English (US) as the base language by opening the ndo$dbproperty table in SQL Server Management Studio and verifying that, in the Identifiers column, the word Object is written exactly as that and not in any other way.

    The example above is only one of the possibilities you might see in case if using other languages than English in naming system columns.

    Company Names in Dynamics NAV 2015

    In more than one situation, you might encounter errors related to the naming conversion of your companies in Dynamics NAV.This is usually not an issue in Dynamics NAV 2015 or any older version; rather it is related to the upgrade routine itself.

    If a company name includes a special character, or it starts with a number, you might get an error: ‘Incorrect Syntax near…’

    • The issue with having this error because of having a digit at the beginning of the company name was resolved in Cumulative Update 3.
    • But still if you are having any other special character ’ in the company name, you might get the same error. In this context, special characters include the following: [ ~ @ # $ % & * ( ) . ! % - + / = ? ]
    • An easy solution for this is to rename the company before starting the upgrade. After the upgrade is successfully finished, you can re-rename the company again.

    We warmly recommend that you maintain a good naming convention, and try to avoid any special characters in company names.

    Upgrade Codeunits and Data Upgrade in Dynamics NAV 2015

    Dynamics NAV 2015 introduces the concept of upgrade codeunits. We worked on the way schema synchronization and data upgrade works in Dynamics NAV 2015, because some of you experienced problems with the way database synchronization worked when we first launched Dynamics NAV 2013 R2.

    Essentially, when you introduce changes to the database schema in Dynamics NAV 2015, Dynamics NAV will be always checking if these changes are destructive or not, and if there is a fear that these change might lead to some data being deleted (such as if you are dropping a table column so that the contents of that column will be deleted). If such as destructive change is detected, you will be prompted to handle the situation using upgrade codeunits.

    This was explained on the community blogs more than once, but we suggest that you watch this video to understand what is really going on: 

    How Do I: Synchronize Database Schema Using Upgrade Codeunits in Microsoft Dynamics NAV 2015

    On the other hand, if you think that these changes are not going to cause issues, you can take a backup of the database, and try to re-run the Sync-Nav Tenant command with the force Option manually again, but we rather advice you to be cautious when it comes to this option.

    It is always better to run Sync-NAVTenant with check mode only to see what objects might be a source of destructive changes.


    As mentioned before, we intended in this blog to summarize some of the tips and the tricks we learned while working on upgrade, some of these information might be basic for some partners, and some might be invaluable, at the end, I just wanted to share the information in a way that might make your life easier when you upgrade.

    Abdelrahman Erlebach

    Microsoft Dynamics NAV Support EMEA

  • Microsoft Dynamics NAV Team Blog

    Best Practices Tips and Tricks for Upgrading to Dynamics NAV 2013 R2 or Dynamics NAV 2015


    Earlier, we announced that Dynamics NAV 2009 SP1 and Dynamics NAV 2009 R2 would go out of mainstream support in January 2015, and that means that the Classic Client stack is no longer supported:

    Mainstream Support for Microsoft Dynamics NAV 2009 ends January 13 including 2009 SP1 and 2009 R2

    We know that many of you have been upgrading to the latest version for years so that you would benefit from the various impreovements and new functionlity that new versions include. but with Classic Client no longer supported, it's time to get your customers upgraded to the Dynamics NAV Windows client, and that’s why we issued lots of documents and articles to help you in this process, including the option of automating the upgrade process.

    But over the past couple of years, we in the Support organization have collected a range of tips and tricks that we would like to share with you to help you get your customers upgraded. We will be summarizing those tips and tricks in 2 blogs, this one and another one following soon.

    The purpose of this is to lay the ground for future upgrades, and to guide you in the best practices for upgrading from the older Dynamics NAV platforms to the latest.

    This includes the following points:

    • Preparation - what should I take care of before I start?
    • What should I follow to guarantee a successful upgrade?
    • Known Issues and how to work around some complicated situations during upgrade.


    The first question is always, what should I take care of before I start? Do I have to prepare anything at all? What are the available toolkits to use, where do I find them?

    Available Upgrade variations and toolkits

    In this section we will be mentioning the available variations from toolkits and methods used to upgrade to Dynamics NAV 2013 R2 / Dynamics NAV 2015, so as you can plan which toolkit to use based on the current version of the database that need to be upgraded.

    First, get the right upgrade toolkit for the job:

    Upgrading from:

    Toolkit / Variation:

    Microsoft Dynamics NAV 2013

    Standard Upgrade Toolkit. 

    Microsoft Dynamics NAV 2013 / R2

    Standard Upgrade Toolkit / Automated Data Upgrade

    Microsoft Dynamics NAV 2009 SP1

    Upgrade first to NAV 2013 and then to NAV 2013 R2 / NAV 2015

    Microsoft Dynamics NAV 2009  R2

    Upgrade Toolkit directly  to NAV 2013 R2 / NAV 2015

    Older Version

    Has to get first to Microsoft Dynamics NAV 2009

    Get the upgrade toolkit from the product media of the version you upgrade to. At the end of this blog post, we list a couple of links to videos and steps.

    OK, now I have the right tool kit, what should I take care of before I start?

    So as you guarantee that you will not face big Issues while upgrading or later on while working on Microsoft Dynamics NAV 2013 R2 / Microsoft Dynamics NAV 2015, please consider the following:

        • Are all objects compiled?
            • You must make sure that all your objects are compiled before the transformation because any not compiled objects can be a potential reason for lots of upgrade issues.
          • What to do with third party objects?
            • Third party objects also have to be fully compiled before you start.
            • You have to have the right license that allows you to compile these objects.
            • If the third party objects are old, and no longer going to be used, you have to delete them before you start.
            • In some situations the license does not exist because there is no relation to the party that developed the component, in this case we have to work around this by deleting the objects from the database and cleaning it from the Objects table and the Objects Metadata table manually on the older database before you start.
          • Why should all objects (if possible) be compiled?
        • Are you using any other language / Localization different than W1?
          • Having a different collation?
            • There was a collation change between older and newer versions of NAV.
            • Starting from NAV 2013 we are pushing the use of Windows collations Vs SQL Server Collations, this means if you used SQL Server special collations in older Databases, you should have some extra work preparing the data.
            • It is mainly about ensuring that no Primary key fields depend on the SQL old collation, so in case you have primary Keys with any special characters, you might be obliged to work on these values before upgrading.
            • One example in the German language is the letter ‘ß’ that would be recognized from the 2 letters ‘SS’ only in some special collations in sql.
            • If you do have a violation of primary key related to such an example, be aware that it is a data issue, and it has to be manually treated.
            • Consider that collation changing for huge databases might be a long process that needs to be planned properly, we will be back to the collation point later on in this document, talking about collation issues.
          • Special caption problem?
            • More than once it was reported, that while converting the data in NAV 2013 R2 / NAV 2015, you get errors related to a value that is invalid.
            • Mainly these Values are coming from the captions of come objects in the older database.
            • After converting the data from non-Unicode to Unicode data, and moving some values between CAL to xml, some characters could give a value that is not recognized by NAV2013 R2 / NAV 2015.
            • These values would be saved in Metadata after or while compiling those objects the first time in NAV 2013 R2 / NAV 2015
            • As an example:
              “Hexadecimal value 0x[whatever] is an invalid character”
              To check what is valid and invalid, please check quickly the link below:
            • The problem here is: sometimes you cannot know exactly where this value might exactly be.
            • If you do not know where the problem is, you could try removing the captions before starting the Upgrade, carry on with your upgrade without it and try to re-import it again afterwards.
        • Do you have Dimension codes and values especially coming from older versions?
          • The structure of dimensions in Microsoft dynamics NAV has changes couple of times between versions, especially if you come from a very old version.
          • What you need to make sure of before upgrading is that if you do have any dimensions used in details tables that they are also existing in the master table of dimensions.
          • Simply you need to make sure that the relation between the dimension value table and all dimension related transaction tables are well maintained.A famous example for a well-known error while upgrading to NAV 2013 R2 / NAV 2015 is the following:
            'Dimension value ID' must contain a value in 'dimension set items': 'dimension set id = 0, dimension code = COST CARRIERS'. Value cannot be null or empty
            'Dimension Value ID must have a Value in Dimension Set Entry' 
            • This is mainly about the relation between the dimension value table and the transaction tables containing dimension Informations
            • For example the values that are in table 355 and do not exist in table 349 can cause such an error.

              You can check the consistency with a simple query (in case it is now related to a missing value in the G/L Entry table):

              select * from

               CRONUS AG$Ledger Entry Dimension] A

               where A.[Dimension Value Code] not in


               select B.Code


               [CRONUS AG$Dimension Value] B


          • In case of any found inconsistency, check the values, and either to add it to the master table 349 or to delete it from 355.
          • The above query example would not apply to all situations, it is just an example to illustrate how to approach such an Issue.
          • Another reason for this, would be having some special characters in the dimension name, which might not be understood after the collation change that took place while opening the database the first time with the Dynamics NAV 2013 client.
          • There was also a good blog discussing the same behavior:
          • Another Example would be also related to dimensions in case you had something to do with Service management Module in older versions
            • Also in Step 2 in NAV 2013 R2 / NAV 2015 you would get a similar error:
          • The Metadata Object of Table 5930 was not found.

          •  There was an Older internal KB article related to upgrading to NAV 2009 with service management module Talking about this before stating the following:
          •  Due to major changes in the design of the Service Management functionality, it is necessary to remove unnecessary service-related data stored in the database to avoid data inconsistency and business logic gaps when upgrading to Microsoft Dynamics NAV 2009.

          • A simple solution to this would be deleting all records related to Table 5930 from table Posted Document Dimension before starting the step 2 at all.
        • Huge Database
          • Upgrading huge Databases should be carefully planned, starting from planning the right resources, up to planning enough time for testing, because it might take you the first time very long till you understand how to optimize he upgrade for a huge database.
          • Every database is a different situation, so please take you time planning for every database based on the following:
            • Do you have owned vertical solutions / customized add-ons.
            • Do you have many Companies in the same database?
            • Do you use FlowFields excessively in your customizations?
            • Is your database more or less than 100 GB, did you plan enough hardware resources on your test server? And please consider doing this starting from the first test to avoid wasting time testing on week machines.
            • Think also about involving Microsoft support from the beginning, to get some advices while planning your upgrade.
          • Huge databases might fall into performance issues while upgrading.
          • We will be back to the subject ‘Performance while upgrading’ again in this document, to talk about it in more details

    What should I follow to guarantee a successful upgrade?

    Upgrading to Dynamics NAV 2013 R2 / NAV 2015 can be a complex and a time consuming if you do not know what guide to follow, for such a long process you need to have always a step by step procedure to guide you till the end of this activity. We do have many materials on this in the community, partner source and on our blogs, but we thought it would be good to mention some of these recommended material so as you can follow while upgrading.

    As we mentioned earlier in this blog post, it depends on which version of Dynamics NAV are you coming from. You can get an overview of the steps required in the MSDN Library here:


    Also, you can watch these videos:

    For upgrading from Dynamics NAV 2013 R2, you can use automation. For inspiration, watch this video:

    This Toolkit with the step by step explanation on how to use it, can be found in the following Blog:

    For upgrading from Dynamics NAV 2009 SP1/R2, at first you had to upgrade to Dynamics NAV 20132, but how you can upgrade directly to Dynamics NAV 2015:

    And the newly released blog post:

    If you upgrade from an earlier verison thaan descirbed here, you have to first upgrade to Dynamics NAV 2009 SP1.

    Be careful with the not compiled objects and the way data were stored in the older versions, as mentioned before in this document.


    As I mentioned before, and that the amount of information is too big to be written in one blog, I will stop here, and complete the rest of the tricks in a future post.

    Abdelrahman Erlebach

    Microsoft Dynamics NAV Support EMEA

  • Microsoft Dynamics NAV Team Blog

    Article for Posting Date on Adjustment Value Entry


    We have published a technical article with guidance for users of the Inventory Costing functionality in Microsoft Dynamics NAV. More specifically, it provides guidance on how the Adjust Cost - Item Entries batch job identifies and assigns a posting date to the value entries that the batch job is about to create. We hope that this will answer some of the questions that people have about this functionality, including how the batch job has been enhanced since the introduction of Inventory Costing in version 3.0.

    You can find the technical article in the MSDN Library in English only here: Posting Date on Adjustment Value Entry

    For now, this is the only technical article in the MSDN Library. We hope to be able to publish other articles in the future.


    Best regards,

    Helene and Eva

    The Dynamics NAV team

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 20 for Microsoft Dynamics NAV 2013 R2 has been released


    Cumulative Update 20 includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2013 R2.

     The cumulative update includes hotfixes that apply to all countries and hotfixes specific to the following local versions:

    •   AU - Australia
    •   AT - Austria
    •   BE - Belgium
    •   CH – Switzerland
    •   CZ – Czech Republic
    •   DE - Germany
    •   DK - Denmark
    •   ES - Spain
    •   FI  - Finland
    •   FR - France
    •   IS - Iceland
    •   IT - Italy
    •   NA - North America
    •   NL - Netherlands
    •   NO - Norway
    •   NZ - New Zealand
    •   RU – Russia
    •   SE - Sweden
    •   UK - United Kingdom

    Where to find Cumulative Update 20

    You can download the cumulative update from KB 3069271  – Cumulative Update 20 for Microsoft Dynamics NAV 2013 R2 (Build 41371). 

    Additional Information

    For more information about cumulative updates for this version, see Announcement of update rollups for Microsoft Dynamics NAV 2013 R2.

    For a list of all cumulative updates for this version, see Released Cumulative Updates for Microsoft Dynamics NAV 2013 R2

    For a list of all hotfixes included in cumulative updates for this version, see the following CustomerSource and PartnerSource pages:



  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 27 for Microsoft Dynamics NAV 2013 has been released


    Cumulative Update 27 includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2013.

    The cumulative update includes hotfixes that apply to all countries and hotfixes specific to the following local versions: 

    • AU - Australia
    • AT - Austria
    • BE - Belgium
    • CH - Switzerland
    • DE - Germany
    • DK - Denmark
    • ES - Spain
    • FI - Finland
    • FR - France
    • IS - Iceland
    • IT - Italy
    • NA - North America
    • NL - Netherlands
    • NO - Norway
    • NZ - New Zealand
    • SE - Sweden
    • UK - United Kingdom

    Where to find Cumulative Update 27

    You can download the cumulative update from KB 3069230 - Cumulative Update 27 for Microsoft Dynamics NAV 2013 (Build 41354).

    Additional Information

    For a list of all cumulative updates for this version, see Released Cumulative Updates for Microsoft Dynamics NAV 2013

    For a list of all hotfixes included in cumulative updates for this version, see the following CustomerSource and PartnerSource pages:



  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 8 for Microsoft Dynamics NAV 2015 has been released


    Cumulative Update 8 includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2015. 

     The cumulative update includes hotfixes that apply to all countries and hotfixes specific to the following local versions:

    •   AU - Australia
    •   AT - Austria
    •   BE - Belgium
    •   CH – Switzerland
    •   CZ – Czech Republic
    •   DE - Germany
    •   DK - Denmark
    •   ES - Spain
    •   FI  - Finland
    •   FR - France
    •   IS - Iceland
    •   IT - Italy
    •   NA - North America
    •   NL - Netherlands
    •   NO - Norway
    •   NZ - New Zealand
    •   RU – Russia
    •   SE - Sweden
    •   UK - United Kingdom

    Note: You must convert the database if you are upgrading to this cumulative update from a cumulative update earlier than Cumulative Update 8 (build 41370). For more information, see Converting a Database in Help for Microsoft Dynamics NAV. 
    However, if you then open the converted database in an older version of the development environment (such as Cumulative Update 7 or earlier), the database will be silently downgraded. You will not see a warning.
    This has no impact on database structure. Users connecting to a Microsoft Dynamics NAV Server that accesses this database will not be affected. But we recommend that you immediately convert the database  again by opening it the new development environment from Cumulative Update 8.

    Where to find Cumulative Update 8

    You can download the cumulative update from KB 3069272 – Cumulative Update 8 for Microsoft Dynamics NAV 2015 (Build 41370). 

    Additional Information

    For information about how to install the cumulative update, see How to Install a Microsoft Dynamics NAV 2015 Cumulative Update

    For information about how to work around a recent process change, see How to Get Back the 'Hotfix Directories' from NAV 2015 Cumulative Update 1.

    For a list of all cumulative updates for this version, see Released Cumulative Updates for Microsoft Dynamics NAV 2015.  

  • Microsoft Dynamics NAV Team Blog

    Coffee Break 13 - Checking file properties and copying files with Windows PowerShell


    This time, we will look at a couple of ways you can use Windows PowerShell to handle files. Either for the purpose of checking file versions without having to ask users, or as an example here we will look at some ideas for applying an update automatically. Please note that the intention with this post is not to provide you with a tool or process of deploying updates, but to get you familiar with the potential of Windows PowerShell using some real-life scenario (as real as they get from a Support perspective).

    Check file version 

    To read file properties in order to find out which build and version of the Dynamics NAV Windows client is installed, we can create a FileSystemObject and get the version with these commands:

    $fso = New-Object -ComObject "Scripting.FileSystemObject"
    $fso.GetFileVersion("${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe")

    Or, we can do the same in a simpler way:

    Get-Item "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe” | % VersionInfo | % ProductVersion

    Or in the case that the NAV client is not installed in program files:

    (Get-ItemProperty  'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft Dynamics NAV\80\RoleTailored Client').Path # Or equivalent for a 32-bit machine


    Now let's create a PSSession object so we can remote into it and run the check on remote user(s) machine(s). Note that the actual script we run is exactly the same as shown above - just run in a PSSession.

    $RemoteMachineName = "UsersMachine"
    $PSSession = New-PSSession $RemoteMachineName

    Invoke-Command -Session $PSSession -ScriptBlock{Get-Item "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe” | % VersionInfo | % ProductVersion}

    For more details about Remoting, including extending remoting to a VM in the Azure cloud, see the Windows PowerShellRemoting coffee break.

    Download and unzip latest cumulative update

    If you don't use the Dynamics NAV image in the Azure marketplace, check this blog for the latest cumulative update. For example, choose the "NAV 2015" tag as in this URL:

    In this example, we have downloaded Cumulative Update 7 (483510_intl_i386_zip.exe) to disk.

    $UpdateFile = "C:\Updates\CU7\483510_intl_i386_zip.exe"

    Our downloads are stamped with an extra stream, so in case Microsoft is not in your list of trusted sites, remember to unblock it (or the next steps will fail):

    Unblock-File $UpdateFile

    For tips on how to (un)zip files using PowerShell, and many other useful tips and scripts, check the excellent PowerShell blog: Hey, Scripting Guy!Blog 

    To unzip files, we'll use the archiving capabilities delivered with .NET framework 4.5 (this will not work with earlier .NET Versions). You can find more details about this library here:

    To load the assembly, run this command: 

    Add-Type -assembly ""
    $Destination = "C:\temp\Hotfix"



    This zip file contains another zip file, so extract that in the same way

    $UpdateFile = "C:\temp\Hotfix\"

    Check file date stamps

    Find the date stamp of your Microsoft.Dynamics.Nav.Client.exe (of course this can also be remoted):

    $lastupdate = Get-Item -path "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe" | % LastWriteTime


    Or check a whole folder:

    $lastupdate = (get-childitem -path "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client").LastWriteTime  
    $lastupdate #Notice that this is now an array of dates as opposed to a single date so we pipe it

    $lastupdate = $lastupdate | Sort-Object DateTime -Descending | Select-Object -Last 1

    Copy newer files from the Cumulative Update

    Find newer files:

    $UpdateFolder = "C:\temp\Hotfix\RoleTailoredClient\program files\Microsoft Dynamics NAV\80\RoleTailored Client\"
    get-childitem  -path $UpdateFolder   –recurse | where-object lastwritetime -gt $lastupdate


    And finally pipe them to the destination folder:

    $ClientFolder = "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client"

    or use the absolute path (and equivalent for each component):

    $ClientFolder = (Get-ItemProperty  'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft Dynamics NAV\80\RoleTailored Client').Path

     #Notice that the above is the path of NAV Client installed on a x64 machine).

    get-childitem  -path $UpdateFolder  | where-object {$_.lastwritetime -gt $lastupdate} | Copy-Item -Destination $ClientFolder


    There are lots of things we haven't considered here, like what if the client is in use, how to handle the rest of the update (Microsoft Dynamics Nav Server and so on), but again, this is not meant as a tool or a step-by-step process, merely an illustration of some of the ways we have for manipulating files, using PowerShell.



    Jasminka Thunes, Escalation Engineer Dynamics NAV EMEA

    Lars Lohndorf-Larsen, Escalation Engineer Dynamics NAV EMEA

    Bas Graaf, Senior Software Engineer Dynamics NAV



  • Microsoft Dynamics NAV Team Blog

    SQL Server Worker Threads and Microsoft Dynamics NAV


    Microsoft Dynamics NAV has been configured to use the Microsoft SQL Server database engine as efficiently as possible. This includes using SQL queries which are appropriate for parallel query execution to speed up the retrieval of data when the SQL Server is configured to allow this. Parallelism in SQL Server can be controlled using the “max degree of parallelism” (aka MAXDOP) configuration option as explained in this article:

    If you enable parallel query execution on SQL Server, complex queries executed by the Microsoft Dynamics NAV application may be broken up into component sub-queries by the SQL Server engine. These sub-queries can run in parallel (each utilizing a different processor), and the results are then combined into a single result set before being returned to the Dynamics NAV middle tier service. On an 8 processor machine, for example, 8 small queries running in parallel will return all of the results faster than a single big query running on a single process doing the same task.

    If you set the SQL Server MAXDOP configuration option to any value other than ‘1’ on a multiprocessor machine, then you are allowing the SQL Server query optimizer to use a parallel query execution strategy where it calculates that this will provide a significant performance benefit. Note that MAXDOP=0 by default after you install SQL Server.

    The kind of SQL Server queries submitted by the Microsoft Dynamics NAV application can often benefit from parallel query execution. In some scenarios with multiple queries split into many parallel query processes there can be hundreds of query threads competing for resources inside the SQL engine. These SQL Server query threads are known as “Worker Threads” and the maximum number allowed is controlled by another configuration option in SQL Server. You can read more about the “Max Worker Threads” configuration option here:

    Normally, the default value for the “Max Worker Threads” SQL Server configuration option is more than enough to cope with whatever Dynamics NAV will throw at it. However, in certain rare scenarios the SQL Server engine can run out of worker threads, especially if the Dynamics NAV middle tier cannot read all of the results being returned to it quickly enough. When this happens the SQL Server instance can become unresponsive until some of the executing threads complete their tasks and can take on some of the pending workload. If you encounter this situation you may see the following error message in the SQL Server errorlog:

    All schedulers on Node 0 appear deadlocked due to a large number of worker threads waiting on ASYNC_NETWORK_IO. Process Utilization 0%.

    In the unlikely event that you encounter this scenario, we suggest that you connect to SQL Server using the dedicated administrator connection (DAC), and kill the process which is consuming the majority of Worker Threads in order to regain control of the SQL Server instance. Then increase the “Max Worker Threads” configuration option as explained in the article above to avoid future occurrences of the issue.  


    Gerard Conroy

    Microsoft Dynamics NAV Support EMEA

  • Microsoft Dynamics NAV Team Blog

    Easy Deployment of the Latest Version of Microsoft Dynamics NAV 2015


    As you all know, Microsoft Dynamics NAV 2015 has been available as an image in the public Microsoft Azure Marketplace since January 2015. This image is updated when each cumulative update is released, and you can choose the exact version that you want to use based on the release date. At time of publishing this post, the latest version is cumulative update 7 from May 13th 2015. So if you want to see the very latest version, such as how the latest tax update works from a tablet device, you can use the pre-configured image to get easy access to the latest functionality.

    As you have seen in the coffee break series, you can use Windows PowerShell to automate deployments based on the Azure images. In this blog post, you can get started with the image itself, and in a later post, we'll take a closer look at the demo scripts that are available on the image.

     The image contains essentially three things:

    • All language versions of the Microsoft Dynamics NAV 2015 product media.
    • A pre-installed W1 version of Microsoft Dynamics NAV 2015.
    • A set of sample scripts that can help you set up a stunning demonstration environment.

    When you create a virtual machine based on the Dynamics NAV image for demonstration purposes, you have to create a number of public endpoints in order to be able to access resources from the outside. Even though this doesn’t seem overly complex, it is still time consuming and a manual process, where you might make a typo or forget to create an endpoint.

    If, instead, you want to automate this process, you can easily do this in Windows PowerShell.

    Of course, you need an Azure subscription before you can get started. If you don't have a subscription already, we recommend that you sign up here:

    Then you need to install the Azure PowerShell cmdlets, following this guideline:

    Once you have installed the Azure PowerShell cmdlets, you can start the Windows PowerShell ISE and run the following script - make sure you choose the relevant values for the 3 properties that are highlighted in yellow:


    # Find the latest Microsoft Dynamics NAV 2015 image

    $image = Get-AzureVMImage | where { $_.ImageFamily -ilike “*NAV 2015*” } | Sort-Object -Descending -Property PublishedDate | Select-Object -First 1


    # Settings

    $AzureServiceName = '<Azure Service Name of your choice>'

    $AzureVirtualMachineName = $AzureServiceName

    $InstanceSize = 'Standard_D2'

    $InstanceLocation = '<Location of your choice>'

    $VMAdminUserName = 'vmadmin'

    $VMAdminPassword = '<Password of your choice>'


    # Create Service

    New-AzureService -ServiceName $AzureServiceName -Location $InstanceLocation


    # Create VM configuration

    $AzureVMConfig = New-AzureVMConfig -Name $AzureVirtualMachineName -InstanceSize $InstanceSize -ImageName $Image.ImageName |

                     Add-AzureProvisioningConfig -Windows -AdminUsername $VMAdminUserName –Password $VMAdminPassword |

                     Add-AzureEndpoint -Name "HTTPS" -Protocol tcp -LocalPort 443 -PublicPort 443 |

                     Add-AzureEndpoint -Name "HTTP" -Protocol tcp -LocalPort 80 -PublicPort 80 |

                     Add-AzureEndpoint -Name "WinClient" -Protocol tcp -LocalPort 7046 -PublicPort 7046 |

                     Add-AzureEndpoint -Name "SOAP" -Protocol tcp -LocalPort 7047 -PublicPort 7047 |

                     Add-AzureEndpoint -Name "OData" -Protocol tcp -LocalPort 7048 -PublicPort 7048 |

                     Add-AzureEndpoint -Name "HelpServer" -Protocol tcp -LocalPort 49000 -PublicPort 49000


    # Create VM in Service

    $AzureVMConfig | New-AzureVM -ServiceName $AzureServiceName –WaitForBoot


    When you run this script, the result is a Virtual Machine that is running the latest cumulative update of Microsoft Dynamics NAV 2015. You can use it for demonstration purposes, or to base your production work on. To do that, you must connect to the VM and configure it for your use. You can install the demonstation packages in the C:\DEMO folder to configure a demo environment that is integrated with Office 365, BingMaps, PowerBI, and a lot of other cool stuff.

    You can use PowerShell to install the demo packages almost automatically, and we'll update you on that in a later post.


    Best regards 

    Freddy Kristiansen

    The Dynamics NAV team

  • Microsoft Dynamics NAV Team Blog

    Problem in Cumulative Update 19 for Microsoft Dynamics NAV 2013 R2


    Because of an inconvenient change of data schema in the application, the application bits are excluded from Cumulative Update 19 for Microsoft Dynamics NAV 2013 R2. A new release of CU 19 without application bits was released today, May 28. For more information, see Cumulative Update 19 for Microsoft Dynamics NAV 2013 R2 has been released.      

    If you downloaded the initial release of CU 19 (released May 11), and you still want to implement it despite the problem in the application code, please read the following information. 


    Cumulative Update 19 for Microsoft Dynamics NAV 2013 R2 has a problematic change that will affect your implementation of the cumulative update.

    The problem is in table 114, Sales Cr. Memo Header, where the number of field 1300, Canceled, is changed to 1301. A typical partner development license does not allow field changes, so you will run into the problem when you try to import CU 19.



    There is no good resolution at the moment (we are working on it), so here are two different ways to work around the problem.

    Workaround 1: Rename the old field and merge the new field. Write code to copy values from the old field to the new field, as follows:

    1. Open table 114 for editing and rename the Canceled field to "Canceled 2".
    2. Create a new object (for example a codeunit) in an allowed range.
    3. Create a variable named SalesCrMemoHeader with datatype Record and subtype Sales Cr.Memo Header.
    4. Copy/paste the following code:

      SalesCrMemoHeader.SETRANGE("Canceled 2",TRUE);


      SalesCrMemoHeader.MODIFYALL("Canceled 2",FALSE);

    5. Run the new object. All data will be transferred from the Canceled 2 field to the Canceled field.



    You will not be able to remove the old field.

    In table 112, Sales Invoice Header, field 1301, Canceled, is a FlowField that uses field 1301 in table 114 in its CalcFormula. Because table 112 is not part of CU 19, the CU will fail if you try to compile table 112 because it points to non-existing field 1300 in table 114.


    Workaround 2: Import table 114 as a .fob file. (The partner development license does not allow deletion of an existing field if you import the table as a .txt file.)

    1. Save the data in custom fields.
    2. Import table 114 as a .fob file. (Note: This will remove the custom fields.)
    3. Re-apply any customizations that you may have lost.
    4. Move the data back.


    Sorry for the inconvenience.

    The Dynamics NAV team

  • Microsoft Dynamics NAV Team Blog

    Coffee Break - Automatic Deployment of Microsoft Dynamics NAV


    This post will round up a small series of how to use Windows PowerShell to provision Dynamics NAV in an automated way. In our examples we do this in the cloud, since here we can already automate the machine and OS deployments, but the techniques here will work in any environment. The key element here is "Automation".

    Coffee Break 12 - Provisioning - Automatic installation and deployment of Microsoft Dynamics NAV

    Previously we looked at how to use PowerShell to:

    1. Create a Virtual HardDisk (VHD),
    2. Create a Virtual Machine (VM) in the cloud, then
    3. Upload our new VHD to our new VM.

    Now, finally we will show how to go ahead an install Dynamics NAV on this new machine. 

    Why provision?

    There is actually a much easier way to get Dynamics NAV running in the cloud: Use the pre-built Dynamics NAV image in Microsoft Azure. If your Azure subscription is an MSDN subscription, then the Azure marketplace should show a Dynamics category when you create a new VM. This category contains a Dynamics NAV image with a complete, pre-configured Dynamics NAV installation. This image can of course also be provisioned using PowerShell. Here's a command that looks for pre-built Dynamics NAV images in the Azure marketplace:

    Get-AzureVMImage | where { $_.ImageFamily -ilike “*NAV*” } | Sort-Object -Descending -Property PublishedDate

    But as mentioned above, the key word here is "Automation". So if a ready-built system is not flexible enough, then keep reading.


    In this post we will assume that you have already created a new VM and uploaded a Dynamics NAV product DVD to this machine.


    The nature of flexibility is that you will need and want to customize this to your exact situation. So the script below will likely need changes, but hopefully it will demonstrate well enough how to complete your automated deployment. The script below is based on the provisioning script on the Dynamics NAV 2013 R2 / Dynamics NAV 2015 product DVD (the folder WindowsPowerShellScripts\Cloud).

    Get started with some settings and load the NAVRemoteAdmin module:


    $DVDLocationLocal = "C:\NAVDVD"

    $DVDLocationRemote = "C:\NAVDVD"

    Import-Module $DVDLocationRemote\WindowsPowerShellScripts\Cloud\NAVRemoteAdministration\NAVRemoteAdministration.psm1 

    Before we continue take a few moments to run this and see the cmdlets that you now have available from the NAVRemoteAdmin module:

    Get-Command -Module NAVRemoteAdministration

    Some of these commands are really useful for bridging the gap between your laptop and the cloud and this post will show how much this module helps simplifying remote tasks.

    Now we move on and set a few more variables, and then create a PSSession object to access the remote machine.

    # Specify the location of your Azure VM

    $RemoteMachineAddress = ""
    $RemoteMachine = "navnew"

    $PSSession = New-NAVAdminSession -RemoteMachineAddress $RemoteMachineAddress -AzureServiceName $RemoteMachine -VMAdminUserName vmadmin -VMAdminPassword HelloWorld2


    Configure an installation config file by running Setup from the product DVD, and then in the installation wizard select to save configuration.xml. Here, we have configured and saved an installation config file in 1BoxConfigFile.Xml, overwriting the existing demo file:

    # Copy installation config file from local machine to the Azure VM

    Copy-FileToRemoteMachine -SourceFile $DVDLocationLocal\WindowsPowerShellScripts\Cloud\NAVRemoteAdministrationSamples\1BoxConfigFile.Xml -DestinationFile $DVDLocationRemote\1BoxConfigFile.xml -Session $PSSession


    In case we need a certificate for Web Client connection:

    # Generate a self-signed certificate
    $Certificate = Install-SelfSignedCertificateRemotely -SubjectName $RemoteMachineAddress -StoreScope 'LocalMachine' -StoreName 'My' -RemoteDirectory "c:\Cert" -Session $PSSession


    # Or import a signed certificate
    # [System.Security.SecureString]$CertificatePfxPasswordAsSecureString = ConvertTo-SecureString $CertificatePfxPassword -AsPlainText -Force


    $WebServerSSLCertificateThumbprint = Get-CertificateByThumbprintRemotely
    $WebServerSSLCertificateThumbprint = Get-CertificateThumbprint -Certificate $Certificate
    $Certificate = Import-PfxFileRemotely `
                                    -PfxFile $CertificatePfxFilePath `
                                    -PfxPassword $CertificatePfxPasswordAsSecureString `
                                    -Session $MySession                               

    # Get installed certificate thumbprint
    $WebServerSSLCertificateThumbprint = Get-CertificateByThumbprintRemotely -Certificate $Certificate -Session $PSSession


    Install the .NET Framework if needed

    Ideally, make sure that the VM you provisioned already has the required version of .NET Framework (4.5). Or if needed you can automate it - look in the provisioning script on the Dynamics NAV 2015 product DVD in WindowsPowerShellScripts\Cloud\NAVRemoteAdministrationSamples\Install-DotNETRemotely.ps1 how to install it and restart the VM remotely if needed.


    Install Dynamics NAV

    # Install prerequisites on VM      
    $DVDLocationRemote = "C:\NAVDVD"
    Install-NAVPrerequisitesRemotely -RemoteNavDvdLocation $RemoteNavDvdLocation -Session $PSSession | Out-Null

    # Install NAV components from dvd copied to VM
    Install-NAVComponentRemotely –RemoteDVDPath $DVDLocationRemote RemoteConfigurationFilePath $DVDLocationRemote\1BoxConfigFile.xml –Session $PSSession


    Additional (optional) settings and finishing off

    # Remove the default IIS web site to free port 80 for the NAV Web Client
    Remove-DefaultWebSiteRemotely -Session $PSSession  

    #Start the web site   
    Start-NAVWebClientRemotely -Session $PSSession

    #Open Azure endpoint for the Web Client. We assume the web client will always occupy port 443.
    $RemoteMachine = "navnew"
    $RemoteServiceName = "navnew"
    Get-AzureVM -Name $RemoteMachine -ServiceName $RemoteServiceName | Add-AzureEndpoint -Name "NAV_Web_Client" -Protocol "tcp" -LocalPort 443 -PublicPort 443 | Update-AzureVM | Out-Null


    This was an example of how to install Dynamics NAV on one machine. Watch out for future posts on how to automate deployment on multiple machines. Example scenario: Automating Cumulative Update deployment.



    Jasminka Thunes, Escalation Engineer Dynamics NAV EMEA

    Lars Lohndorf-Larsen, Escalation Engineer Dynamics NAV EMEA

    Bas Graaf, Senior Software Engineer Dynamics NAV


Page 1 of 51 (758 items) 12345»