Potential data loss in NAV 2013 R2 fixed

Update Rollup 5 for Microsoft Dynamics NAV 2013 R2 has been released.

You can download update rollup 5 from KB 2937999 – Update Rollup 5 for Microsoft Dynamics NAV 2013 R2 (Build 36281).

This hotfix resolves the following problems:

ID Title
358016 <Field A> -= <Field B> – <Variable> statement calculates incorrect results.
357968 The Windows client crashes when you click a column header to change the sort order in a list page.
357487 Data loss can occur when you change an object multiple times or compile all objects in a live database that has active users connected.
357430 Script control add-in that opens a new browser window does not work in the web client.
357397 “Your entry of [decimal value] is not an acceptable value for ‘Duration’. The value [decimal value] can’t be evaluated into type Duration” error when you enter a decimal value into a field of type duration.
357335 Filtering on worksheets is not working in the web client.
357223 The RecordRef.FIELDEXIST(0) function always returns TRUE.
357105 The Windows client is leaking memory.
356809 “The custom numbering ID format should start at 164 and should be listed in consecutive order” error when you export an account schedule to Microsoft Excel.
356632 “A call to System.IO.StreamWriter.Close failed with this message: Cannot access a closed file” error when you close a stream object from code.
356339 “Invalid index 0 for this SqlParameterCollection with Count=0” Event Log error when you run multiple NAV server services on the same computer.
356335 “The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state” error when you import or compile a table.
356332 Field disappears after you have done a lookup in the field and customized the lookup page.
356284 A subpage is not automatically editable or noneditable when the main page is set to editable or noneditable.
356167 “The filter “[date]” is not valid for the Document Date field on the Sales Invoice Header table. The value “[date]” can’t be evaluated into type Date” error when you select filter to this value on a date column with non-English regional settings.
356090 You can unexpectedly import a table object that removes a column that contains data in the existing table when the table was created by using Save As from the Import Worksheet.
356044 Sorting option is missing in report request pages.
355957 CR (Carriage Return) and LF (Line Feed) creates indentations in ADCS (Automated Data Capture System).
355917 Performance is slow in list pages that have flowfields.
355804 “A security filter has been applied to table [table name]. You cannot access records that are outside of this filter” error when you change a record in a table with flowfields and security filters.
355484 “The metadata object Page [page ID] was not found” error when you select Customize Ribbon in a report request page.
353961 The Windows client stops responding after a window that is opened by an object that has the Dialog.OPEN statement is closed because an implicit Dialog.CLOSE is missing.

I just finished installing this upgrade at a client site.  It was, however, for me not a painless procedure.

I am using PowerShell scripts that upgrade both client and servers.  On the server it will stop the service tier, upgrade the files and start the services again.  This seems to be the problem.

When the Developement Environment is opened with this version 7.1.36281.0 the database will be upgraded.  For this part a single user access to the database is needed so the service tier must be stopped.  This part was without any problems.  The database was converted and things look fine.

Then I started the service tier again and tried to connect.  The client failed to connect and I got this error

The server “<servername>” was unable to process the request.  Close the application and start again.

So I was stuck.  I tried a lot of things and finally found the solution.  In a database that was working I found that the TenantVersionNo in the $ndo$tenantproperty was 1030 but in faulty databases it was 1020.


I stopped all services, modified the TenantVersionNo to 1030 and started again.  Rock and roll…

Insert network printers automatically

In my current upgrade project I need to upgrade a solution I did for Classic NAV where I used the “‘Windows Script Host Object Model’.WshNetwork” Automation object to add a network printer automatically.

I looked a round and did not find any dotnet object capable of adding a network printer.  However, there was a c# code I found that was able to do this.  So, I created a NAV Add-in with this code

[code lang=”csharp”]using System;
using System.Runtime.InteropServices;

namespace NAVPrinterAdd_in
public static class PrinterControls
static extern bool AddPrinterConnection(string pName);

public static bool AddNetworkPrinter(string networkPrinterPath, ref string networkMessage)
bool result;
result = AddPrinterConnection(networkPrinterPath);
networkMessage = "";
catch (Exception e)
result = false;
networkMessage = e.Message;
return result;


The Add-in is attached. Next I created a Codeunit in NAV.


And used in Codeunit 1, FindPrinter trigger.


Now I can make sure that the correct printer is installed for the client and also for the server when printing from NAS session.


Three new suggestions on Microsoft Connect

I am keeping busy doing an upgrade for an Icelandic company from NAV IS 4.0 SP3 to NAV 2013 R2.

Still have a few posts in my backlog that I would like to complete.  This includes a document scanner for the Incoming Documents and a set of PowerShell Commandlets and scripts that include the installation of a KB package for both client and servers.

In the upgrade and testing process I see that there is a room for improvement in NAV.  Just now I created new suggestions on Microsoft Connect.

If this is in align with your view then follow the links and add your vote.

Browse for folder dialog

I have in several cases needed to allow a user to select a folder.  I was surprised to see that Microsoft did not have a browse for folder function in Codeunit 419.

I hereby suggest that Microsoft add this function to Codeunit 419.

[code] PROCEDURE BrowseForFolder@47(VAR FolderName@1000 : Text;Description@1001 : Text) : Boolean;
FolderBrowserDialog@1002 : DotNet "’System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089′.System.Windows.Forms.FolderBrowserDialog" RUNONCLIENT;
DialagResult@1003 : DotNet "’System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089′.System.Windows.Forms.DialogResult" RUNONCLIENT;
FolderBrowserDialog := FolderBrowserDialog.FolderBrowserDialog;
FolderBrowserDialog.Description := Description;
FolderBrowserDialog.SelectedPath := FolderName;
DialagResult := FolderBrowserDialog.ShowDialog;

IF DialagResult.CompareTo(DialagResult.OK) = 0 THEN BEGIN
FolderName := FolderBrowserDialog.SelectedPath;