Microsoft Dynamics NAV

Team Blog

  • Microsoft Dynamics NAV Team Blog

    How to enable Document Map in a Report


    Here are the steps to leverage the use of “Document Map” in a Report.

    1. Design Report 113 Customer/Item Sales

    2. Select View / Layout

    3. Right click on Table top left corner


    4. Select Properties

    5. Navigate to “Groups” tab


    6. Select Table1_Group

    7. Select “Edit…”

    8. Select “=Fields!Customer_Name.Value” in “Document map label”


    9. Select “OK”

    10. Navigate to “Navigation” Tab

    11. Enter “Customer” or what you want the title to be in the Document List


    12. Select “OK”

    13. Save and import RDLC changes, and then compile report in Classic client.

    14. Run Report 113, it now looks like this:


    Notice the expand in the top left corner. Unfortunately this does not display anything in NAV 2009 RTM, this will be fixed in SP1.


    16. Click the expand button to see the Document Map


    17. Now click the customer “Klubben” and notice that the report in to the right navigates to the area where info about the customer “Klubben” is displayed.


    Also check out Waldo's Blog for an example on how to use Document map:


    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Updated April 2nd 2009 - How to add a Company Picture to a Report


    UPDATED April 2nd 2009: Several people have reported to me that the first solution I posted for “How to use the Picture stored in Company Information table:” did not work for them. So I have now updated the section on how to use the picture stored in the Company Information table. The picture is now added in a slightly different way.



    There are several ways to do this. Either you use the existing Picture which is stored in table 79 Company Information or you can embed the image into the Report itself, or you can link to the picture externally. In this scenario I will be looking at how to use the picture already in the database and and how to embed the picture into the report itself.

    How to embed the Picture:

    1. For us to be able to embed the picture into a report we need to have the Company Picture as a file. I have exported the company picture to c:\temp\CompanyPicture.bmp

    2. Ok, now let us add this to Report 111. Design Report 111

    3. Select "View/Layout" to go into Visual Studio.


    4. Select the Report and choose "Report/Embedded Images"


    5. Select "New Image..." and select your company picture, in my case c:\temp\CompanyPicture.bmp


    6. With that completed open the Toolbox and add a Image control to the Report.


    7. With the Image Control added we need to the set correct properties for this control. Set Source=Embedded, Value=companypicutre and MIMEType=image/bmp


    9. Save and import RDLC changes, and then compile report in Classic client.

    10. Run "dynamicsnav:////runreport?report=111" to open up report 111. And as you can see below company picture is displayed.


    We have no looked at how to embed the Company Picture into the report. Now let us have a look on how to use the Company Picture already in the database.

    How to use the Picture stored in Company Information table:

    1. Deleted the above embedded Company Picture, if you followed the steps above.

    2. Design report 111

    3. Now we need to have a Variable with is references to the Company Information Table. Lets create a new called CompanyInfo


    4. Exit C/AL Globals and ad the following code to the "OnPreReport()" trigger: CompanyInfo.CALCFIELDS(Picture);


    5. Now we should add a Picture Box on the Sections with SourceExpr: CompanyInfo.Picture. We need to do this to have the element available for us in Visual Studio.


    6. It is now time to open Visual Studio. Select "View/Layout"

    7. Notice that we now have an new entry in  the DataSet


    8. Now lets add this to the report. We need to add the Company Picture first as a TextBox to the body of the report. This will enable us to use it in the Page Header. We add this TextBox in top of the Body.


    9. We give the TextBox the following properties:

    Value: “=Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)”
    Name: “CompanyPicture
    Visibility Hidden: “True
    Color: “Red

    10. Now add the following code to the Report properties.

    Shared PictureData as Object

    Public Function GetPicture() as Object
    Return PictureData
    End Function

    Public Function SetPicture(NewData as Object)
    if NewData>""
    PictureData = NewData
    end if
    End Function


    11. Now let us add the Image control just as we did for the embedded scenario. Open the Toolbox and add a Image control to the Report.


    12. With the Image Control added we need to the set correct properties for this control.

    Value: “=Convert.FromBase64String(Code.GetPicture())
    Source: “Database
    MIMEType: “image/bmp

    13. Add textbox to Page Header. Note! This textbox has to be placed above the Picture control just added

    Value: “=Code.SetPicture(ReportItems!CompanyPicture.Value)
    Visibility Hidden: “True
    Color: “Red


    14. Save and import RDLC changes, and then compile report in Classic client.

    15. Run "dynamicsnav:////runreport?report=111" to open up report 111. And as you can see below company picture is displayed.



    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    How to make Sub Groups in a Page


    In the new RoleTailored client in Microsoft Dynamics NAV 2009 you do not have the possibility to place a field exactly where you want on a page. You can control in which order they should be shown, but where the field will be placed, is up to the RoleTailored client. This is quite different compared to the Classic where we could define Xpos and Ypos for each control.

    Using Sub groups in the Page Designer you can control how fields are grouped. This way you can fix fields to the left side of a FastTab and to the right side of the FastTab. Let see an example of this.

    Here is how the "General" FastTab on the Customer Card looks out of the box with no customizations:


    But adding 2 Sub Groups you can have the General FastTab look this:


    How did I do this? Well let's have look at Page 21 in Page Designer where I have added these 2 groups marked with blue:


    While the "General" and "Group 1" seem very similar in Type and Subtype, the important part to notice here is INDENTATION. My "Group 1" is indented under the "General" FastTab group. And when indented under a FastTab group this will be displayed as group and not as a FastTab.
    Then of course I have indented the fields "No., Name, Address, Address 2, Post Code and City" below "Group 1" to have these fields captured in this group. For "Group 2" I done the same.

    Actually we go one indention level deeper. Try to add a Sub Group in either "Group 1" and "Group 2" and indent some of the fields into to this new sub Group.

    Using Sub Groups gives a bit more control on where fields are placed in the page on the RoleTailored client.


    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Platform updates for NAV 5 SP1 Upd1


    This overview of KB-releases and build numbers, is an extension to this one:

    "Servicepacks & Platform Updates for Microsoft Dynamics NAV"

    Links in the table are to the corresponding documentation on PartnerSource (login required), where available.

    DBVersionno for all builds = 95.

    5 Sp1 Build KB Number Released Description
    Update 1




    Platform Update 1 for NAV 5 SP1.




    In some cases, when filtering, fin.exe and finsql.exe may return different results.




    DBCS character display is inconsistent when entering more characters than are visible in a text box





    NAV may crash when opening and closing many forms that run modally. Often with error 1247 in module 19.




    BizTalk - Sending a document returns error, even if the document was sent OK.





    Backup/Restore of single company can cause - "Company Name <companyname> does not exist" error - Native only





    Indexed views always rebuilt when compiling/modifying/importign table objects in SP1





    Changes in Production Schedule are not saved - Native only




    XMLPort.EXPORT cannot handle DBCS Characters.





    Permissions too restrictive when calculating flowfields with security filters (recordlevel security)




    RunModal error screen when deleting record links in certain cases




    Save report to html can save the wrong space characters.




    Lookup list in report request forms do not open.




    XML Ports do not import data that comes after a white space.

    Lars Lohndorf-Larsen (Lohndorf)

    Microsoft Dynamics UK

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    How to get a Dynamics NAV report with a Web Service


    1. Create a new codeunit. In this scenario we will call this codeunit "CUWebReport" with ID 50000

    2. Navigate to "C/AL Globals" and create a function called "GenerateReport"


    3. Select "Locals"

    4. Select the "Return Value" tab

    5. Set "Return Type"=Text and "Length"=100


    6. With this completed close "C/AL Locals" window.

    7. Now with "C/AL Globals" windows active again. Select "Variables" tab.

    8. Create a variable called "filename" with "Data Type"=Text and "Length"=100


    9. Now let's add the following code to this codeunit:

    filename := 'C:\inetpub\PdfDocuments\';
    filename += FORMAT(CREATEGUID);
    filename := DELCHR(filename, '=', '{-}');
    filename += '.pdf';


    10. Save and compile the codeunit.

    11. Now it's time to expose this codeunit as Web Service. Navigate to "Administration/IT Administration/General Setup/Web Services"

    12. Select codeunit 50000 and give this a service name, we use "Get_PDF_Report"


    13. Now it is time to verify that we can see this web service. Open this URL  http://localhost:7047/DynamicsNAV/WS/services.

    You should now see this message in your browser, and your Web Service can now be called :


    If you don't see this message, you might want to check that  the service "Microsoft Dynamics NAV Business Web Services" has been started.

    14. Now it is time to call the Web Service, in this example we use Microsoft Visual Web Developer 2005. And we use the following code to call the Web Service:

    Partial Class _Default
        Inherits System.Web.UI.Page

        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim service As localhost.Get_PDF_Report = New localhost.Get_PDF_Report()
            service.UseDefaultCredentials = True
            service.Url = "
            Response.ContentType = "application/pdf"
            Dim pdfFileName As String = service.GenerateReport()

        End Sub
    End Class

    But how to consume this Web Service is not in scope for this blog, so we suggest you have look our online help how to consume a Web Service from NAV 2009.

    Online help found here:

    15. Now also remember to impersonate your web servers application to an appropriate Dynamics NAV user.

    16. After compiling a running our project we then get this button in our browser.


    17. When activating this button, we get the report specified in Codeunit 50000 displayed as an PDF file in our browser.


    Conclusion, now you can give this URL to people who don't have access to Dynamics NAV, and they can execute the report when they see a need for this.


    Torben Meyhoff, SDE & Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Installing the NAV 2009 demo database to a SQL Server named instance


    One of the questions that has been raised frequently is how to install the Dynamics NAV demo database to a named instance of Microsoft SQL Server using the new installation program that was released with Dynamics NAV 2009. The short answer to this question is that this is not supported. However, there is a work around that in fact will allow you to do this.

    Before going into how this can be accomplished there are a few things I need to highlight.

    • You cannot repeat this work around several times on a computer in order to install several demo databases. The work around involves running Windows Installer files (msi) and running such a file a second time will only repair or uninstall the product rather than installing a new instance of the product. You can create a demo database manually using some of the files on the installation media, but this is not within the scope of this blog entry.
    • You must not run the Microsoft Dynamics NAV 2009 installation program (setup.exe) on the computer after you have installed the demo database using this work around since this will uninstalled the demo database. This happens because the Microsoft Dynamics NAV 2009 installation program keeps an inventory of the Dynamics NAV products that have been installed to the computer and will uninstall those which are not in the inventory.

    Now with this in place let's proceed with the work around.

    The task at hand is to install the Dynamics NAV 2009 demo database to a named instance of Microsoft SQL Server 2005. The name of the instance is "CRONUSDEMO" and has already been installed to the computer "CRONUSSERVER" with the service account "NETWORK SERVICE". The Microsoft Dynamics NAV 2009 installation media is located in the DVD drive of your computer (D:\), but it will also work if you install from a local folder or a network drive. You must have administrative privileges on the computer.

    1. Open a Command Prompt on the computer. You must open the command prompt as Administrator if the OS is Vista and you are running with User Account Control (UAC) turned on.
    2. Run the following command:
      msiexec -I "D:\SQLDatabase\Microsoft_Dynamics_NAV_SQL_Database.msi" INSTANCENAME=CRONUSDEMO
    3. Run the following command:
      msiexec -I "D:\SQLDatabase\Microsoft_Dynamics_NAV_SQL_DemoDatabase.msi" INSTANCENAME=CRONUSDEMO

    The demo database is now installed and you should see two entries for this in the control panel.

    To use the newly installed database with the Microsoft Dynamics NAV RoleTailored client you must manually set the Microsoft Dynamics NAV Server to connect to the SQL Server named instance. To do this you must edit the configuration file of the server.

    1. Open the CustomSettings.config file using a text editor. You can find the file in the folder "\Program Files\ Microsoft Dynamics NAV\60\Service".
    2. Locate the DatabaseServer key.
    3. Change the value attribute to CRONUSSERVER\CRONUSDEMO

    You do not have to change any settings on the RoleTailored client in order to connect to the database.

    - Michael Riddersholm Petersen

  • Microsoft Dynamics NAV Team Blog

    GetCompaniesList error configuring Outlook Sync to use Web Services


    In NAV 2009, Outlook Synchronization includes the option to use the new Web Services functionality instead of using C/FRONT and NAS. This is great and demonstrates some of the functionality that Web Services has to offer.

    One issue that can arise when setting this up in a “3 machine” environment is when configuring the Microsoft Office Outlook Add-In. When selecting a company, you could receive an error similar to one of the following.

    The connection to "" Microsoft Dynamics NAV database failed. The program returned the following error: GetCompaniesList error: The login failed when connecting to SQL Server xxx. connection string: NavSynchronizationUrl=http://yyy:7047/DynamicsNAV/WS/Codeunit/DynamicsNAVsynchOutlook;CompanyName=zzz; Please verify your synchronization settings. If the problem persists contact your system administrator.

    The connection to "" Microsoft Dynamics NAV database failed. The program returned the following error:GetCompaniesList error: The request failed with HTTP status 401: Unauthorized. connection string: NavSynchronizationUrl=http://yyy:7047/DynamicsNAV/WS/Codeunit/DynamicsNAVsynchOutlook;CompanyName=zzz; Please verify your synchronization settings. If the problem persists contact your system administrator.

    Note xxx is the server name of the SQL Server (Database Tier), yyy is the server name of the Dynamics NAV Server (Service Tier), and zzz is the company name.

    These errors can occur if NAV Web Services are not setup with the correct SPNs and delegation information. If you haven’t already, make sure your have reviewed the walkthrough on setting up a 3 machine install (found in the nav_install.chm help file, NAV Help can be downloaded here.) and the previous post about setting up NAV 2009 Web Services.

    Scott Wright (scowri )
    Microsoft Dynamics NA

    Microsoft Customer Service and Support (CSS) North America

  • Microsoft Dynamics NAV Team Blog

    NAV 2009 Web Services on a three machine setup


    Much like the setup of the RTC/NAV Server connection in NAV 2009. NAV 2009 Web Services needs to have a SPN added to properly authentic the users accessing it.

    Consider the following scenario in Microsoft Dynamics NAV 2009. You have just completed the “Installing the Three Tiers on Three Computers” walkthrough. The NAV Role Tailored Client (RTC) is working. You have started the Microsoft Dynamics NAV Business Web Services service. When you attempt to view a Web Service URL in a web browser from a client machine you receive a login prompt. If you try to login, you are prompted three times before the process is stopped. An example of possible Web Service URLs is:


    Note xxx is the server name of the Service Tier. This also assumes that you are using the default port (7047) and default service name (DynamicsNAV).

    This problem occurs because a Service Principal Name (SPN) has not been added to the domain user account running the Microsoft Dynamics NAV Business Web Services service for the HTTP service, which is the normal service name used by web services.


    In order to eliminate the login prompts and allow authorized users to view the Web Services URL, you need to add the following SPNs to the domain user account running the Microsoft Dynamics NAV Business Services service.


    Now, I'm sure you all know if you use the ADSI Edit snap-in, or another utility such as the LDP or LDAP 3 utilities to incorrectly modify attributes to AD objects you could seriously mess up the AD, so be careful. Also, you need to be a domain admin to make the following changes.

    To add the SPNs from a domain server, follow these steps:

    1. Click Start, click Run, type Adsiedit.msc, and then click OK.
      Note The ADSIEdit tool is included in the Windows Server 2003 Support Tools. If you are using Windows Server 2008 the ADSIEdit tool will already be installed. To obtain the Windows Server 2003 Support Tools, visit the following Microsoft Web site:
    2. In the ADSI Edit snap-in, expand Domain [DomainName], expand DC= RootDomainName, expand CN=Users, right-click CN= AccountName , and then click Properties. If you are on a server running Windows Server 2008, you may need to first connect and bind to an instance.
      DomainName is a placeholder for the name of the domain.
      RootDomainName is a placeholder for the name of the root domain.
      AccountName is a placeholder for the account that you specify to start the NAV Server service.
      If you specify a domain user account to start the NAV Server service, AccountName is a placeholder for the domain user account.
    3. In the Properties dialog window locate the servicePrincipalName attribute and double click it to open the Editor Dialog window.
    4. Using the following format enter the following two SPNs individually. Click the Add button to add each SPN.

    5. When finished, click OK, and then OK. Finally close the ADSI Edit window.

    Additional Information

    Since Kerberos ticket usually expire after 10 hours, you may need to purge the current Kerberos tickets from client machine before the setup of the Microsoft Dynamics NAV Outlook Add-in can be completed in Microsoft Outlook.

    With Kerbtray.exe, you can easily verify or remove (or both) Kerberos tickets from any of the associated computers that are being used. To download the Kerbtray utility, visit the following Microsoft Web site:

    Scott Wright (scowri)
    Microsoft Dynamics NA

    Microsoft Customer Service and Support (CSS) North America

  • Microsoft Dynamics NAV Team Blog

    The COPYSTREAM “problem” for Sockets


    I must say that since I started working in the integration area of NAV (from within NAV), I got very interested in the possibilities that it would bring to NAV developers. Back then, I presented a Web Server for the NAS using the Socket ComCom and since then I have seen how people have used the streams and specifically the MSMQ Bus Adapter for integrating services and data.

    When writing the code for the STREAMS (InStream and OutStream), I thought it would be very useful to write a function that could copy from one to another, reading from the InStream and writing to the OutStream. However, when using Sockets, there is an essential problem to completing this task. Since TCP data can contain anything (literally any data), and since the data size is also unknown and un-limited, how can we know when the copying has been completed?

    Recently I was dealing with a problem that I found within one of the communities forums (yes, we are reading) and it was regarding XMLPorts. You need to stream the data to and from them, so I rapidly wrote a codeunit that would allow me to read the XMLPort to a file; for that, I used the COPYSTREAM function to read from the XMLPort to a FILE. A couple of minutes later, I found out that my file was not filled out correctly as it was truncated, and immediately went into the code to further debug the problem. I quickly found out that the problem was that the COPYSTREAM was not reading till the End of Stream (EOS). I was puzzled to find an error in the COPYSTREAM code after all this years, but of course I thought that the call to the EOS was simply missing. Once I saw that the call was in fact there, it finally hit me…. InStream.EOS is not working, or, it cannot really work.

    The real problem here is, how do we know when a stream will not send us more data? Usually this is done through a protocol (like http, ftp, etc) but without a protocol, it is not possible to have a clear rule when we have the EOS. Is it a NULL termination? Is it 2 x CR+LF? Or what about a dot in an empty line? The truth is that, we could make rules, but we cannot have a generic answer to all possibilities.

    Depending on your specific conditions, and specially the size of the data you are sending, you might not see this problem at all. But maybe, from time to time, you have noticed that data being received gets truncated and you are trying to figure out what went wrong.

    To further illustrate the problem, let’s receive a file using Sockets and Save it on our local file (I’ll skip the sending code unit, but it can very easily be done following the samples provided in the Development Guide for Communication Components):

    COPYSTREAM for Sockets


    In the environment where I am writing this, I can send files without any issue up to approximately 25 Kb. After that, everything seems to work fine, except that the file gets truncated, that is, I am trying to send a 48 kb file, but get a truncated one.

    In order to get rid of this problem, I suggest copying the stream one char at a time, so the code could look something like:

    'COPYSTREAM' time based.

    The retry is necessary, because we cannot rely on InS.EOS. InS.EOS also suffers from the fact that we don’t know when the stream will stop sending us data.

    A nicer way to deal with this would be to first send how big the data is. That way, we don’t have to rely on time to assume that the information has indeed completed its transmission. If you are sending XML documents, you could also use the DOMDocument.load(InS) return value, to see if the received data indeed contains a valid XML document. If you have access to codeunit 7700, you can see an example on how this could be achieved (as you need to first copy the stream).

    Of course, as mentioned before… This issue will only happen with the raw SocketBusAdapter.

    Jorge Alberto Torres (jtorres)
    Software Developer Engineer

  • Microsoft Dynamics NAV Team Blog

    What are the Visual Studio options for developing RDLC reports for Dynamics NAV 2009


    Updated 24. September 2009 to include options for Dynamics NAV 2009 SP1. / Claus Lundstrøm

    Today we have the following outlined in our Online Help

    For development of reports for the RoleTailored client, one of the following products is required:

    · Microsoft Visual Web Developer 2005 Express edition SP1 or above

    · Microsoft Visual Studio 2005 Standard or Professional SP1 or above

    · Microsoft Visual Studio 2008 Standard or Professional or above

    Note: If Microsoft Visual Web Developer 2005 edition is used, the Reporting Add-In for Microsoft Visual Web Developer 2005 is also required.


    I would like to elaborated on this because other version are also available and we also have a hotfix available for Microsoft Visual Studio 2005 users which need explaining.

    So here it goes. The following editions of Visual Studio are supported:

    Microsoft Visual Studio 2005 Editions:

    · Microsoft Visual Web Developer 2005 Express edition with SP1. With “Reporting Add-In for Microsoft Visual Web Developer 2005

    · Microsoft Visual Studio 2005 Standard or higher editions with SP1

    Tip: If SP1 is not installed for any of the 2005 version you will be asked to convert report when opening Visual Studio from Classic Client. Converting the report will not do any good, so SP1 is required.

    Note: Visual Studio included in SQL Server 2005 is not supported.

    Microsoft Visual Studio 2008 Editions:


    Note: ZIndex hotfix is included in SP1 for Visual Studio 2008. ZIndex hotfix issue explained  in the end of this blog post.

    Note about Microsoft Visual Web Developer 2008 Express Edition: NOTE: ONLY IF YOU ARE USING DYNAMICS NAV 2009, SINCE THIS HAS NOW BEEN FIXED IN RELEASED SP1
    Unfortunately this does not work out of the box with NAV 2009 RTM, since “Microsoft Report Viewer Add-on for Visual Web Developer 2008 Express Edition” was released after NAV 2009 RTM.

    When using Visual Web Developer with Report Viewer Add-on, you will be asked to convert report when opening Visual Studio from Classic Client. Converting the report will not do any good.

    There is a workaround for this:

    1. Navigate to “C:\Program Files\Microsoft Dynamics NAV\60\Classic”

    2.  In this folder there is 2 folders called “ReportLayout2005” and “ReportLayout2008”

    3. Copy all files from “ReportLayout2008” to “ReportLayout2005”

    Doing this will of course kill support for “Microsoft Visual Studio 2005” and “Microsoft Visual Web Developer 2005 Express” on this specific client, but now Visual Web Developer 2008 works, and you no longer get the convert report message. We plan to have this issue resolved in SP1 for Microsoft Dynamics NAV 2009, so there is no need for this manual workaround.

    ZIndex issue:

    • Without ZIndex hotfix:

    When making any change to a report in Report Designer(Visual Studio) all ZIndexes will be updated in the RDLC.

    • With ZIndex hotfix:

    When making any change to a report in Report Designer(Visual Studio) only ZIndexes for the specific change will been updated.

    Having the ZIndex hotfix installed will make comparing of changes in between version of a report easier.

    Hotfix works for all Visual Studio 2005 versions. ZIndex hotfix is included in SP1 for Visual Studio 2008, but please notice that hotfix is not available in Visual Studio 2008 without SP1.

    Read more about the ZIndex hotfix for Visual Studio 2005, and how to obtain here.


    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Using SQL Server 2008 Express


    Small tip, if you want to use SQL Server Express 2008 instead of SQL Server Express 2005 which is included in the Microsoft Dynamics NAV 2009 RTM installation, here is what to do:

    The Demo installation of NAV 2009 RTM is looking for a instance called MSSQLSERVER, so if this is not detected during install, SQL Server Express 2005 will be installed, and Demo Database will be attached to SQL 2005 even though you might have had SQL 2008 Express installed.

    So to avoid this set the Instance to MSSQLSERVER on the SQL Server 2008 Express. This way SQL Server 2008 Express will be used and SQL Server 2005 will not be installed.

    Note: SQL Server 2008 requires the following:

    .NET Framework 3.5 SP1
    Windows Installer 4.5
    Windows PowerShell 1.0 (Included in Windows Vista SP1 and Windows Server 2008)


    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Upgrading Application Objects - Tips


    Some partners use the Merge tool in the NAV Developer Toolkit to attempt to merge the FULL set of objects from the old and new versions. This is not necessary and often will cause more problems than it is worth.

    For the purpose of discussion, let's say that you are upgrading a database from version 3.70 to 5.0 SP1.

    One common error that occurs is something like this...

    Your program license does not permit you to delete the IC Partner Code field in the table.

    The IC Partner Code field is a field that did not exist in 3.70 but has been added to the 5.0 SP1 database. Most often what we find is that partners are mistakenly trying to import the merged objects into the Customer's database when they receive errors like this. The new fields for 5.0 SP1 do not exist in the customer's database. You will not be able to import the merged text file that you created from the Developer's Toolkit into your customer's database. You must first import the text file into a base Cronus 5.0 SP1 database. Once the import has completed successfully, you will then export all the objects from this database as an fob file, and then you will be able to import the fob into your customer's database.

    These program license errors also occur if the object merge is not handled correctly. The main thing to keep in mind is that there will be fields that existed in 3.70 that do not exist in 5.0 SP1 and new fields in 5.0 SP1 that did not exist in 3.70. A partner license will not permit you to delete or create fields in the NAV reserved range. However, this SHOULD NOT be a problem if the object merge is done correctly. Keep in mind that if there have been NO modifications to an object, then there is no need to import a merged version of that object into 5.0 SP1. Any data from 3.70 that needs to be converted will be handled during the data conversion part of the upgrade process. When you run step 1 of the upgrade toolkit, the data that needs to be converted will be moved over to temporary tables and then converted during step 2.

    Concentrate on your modified objects. If you are going to use the NDT to perform the merge, try working with only the modified set of objects rather than trying to merge every object in the database. As a matter of fact, it will often be faster to manually re-enter your modifications in the base 5.0 SP1 database than to try to track down all of the errors that can occur with the merge. One option is to use a text compare tool to compare the base 3.70 unmodified table to your modified one, then manually copy and paste your modifications into 5.0SP1. The NDT function Compare Two Versions works well for this purpose. TIP: Make sure before you do a text compare that the language layers in the "Old Base Version" match the "Current Custom Version". This will prevent having nearly every object show differences in the Compare Tool due to captions...

    Open a clean Cronus database for your Old Base Version.
    Go to Tools/Object Designer.
    Go to Tools/Language Module/Export
    Select a file name on your computer for the export in case you should need it at some time in the future.
    Select one of the languages that you do not want and then be sure to click the Delete Language text box. Select OK.
    Repeat for each of the languages that you do not need.

    Another thing to keep in mind when using the Merge Tool in the Developer Toolkit is that you usually cannot just Accept All Changes with a set of customized objects, because there are almost always conflicts in code that must be resolved manually. Many developers prefer to use the Compare tool in the toolkit and then copy and paste the changes manually into the new version. Compare and Merge is a tool for developers to use as they see fit, but it is not flawless, so you should always check the suggested changes and resolve any conflicts manually.

    Laura K. Lake (lalake)

    Microsoft Dynamics NA

    Microsoft Customer Service and Support (CSS) North America

  • Microsoft Dynamics NAV Team Blog

    Dynamics NAV 2009 and MS Office Integration, send-to Excel and Word


    This blog describes changes in office integration feature, send-to Excel and Word, when using RTC client in NAV 2009. 

    Send-to menu option on RTC client is typically located in menu, under Actions - Send to option. Shortcuts for this functionality is added, but unlike version 5.0, only send -to Word and Excel options are available.

    To export any page to Word/Excel, open the page and in Actions-Send-to menu select Word or Excel. The style sheet selected as default for that page/all pages will automatically be selected.

    Codeunit 403 is no longer called by client when selecting these options, so any customizations of this process will not be used by RTC. This also means the Style Sheet tool can not be used with RTC.

    There are no changes to this functionality when running with Classic client for NAV 2009.


    Jasminka Vukovic (jvukovic)

    Microsoft Dynamics NO

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    Start Your Search Engine: Microsoft Dynamics NAV 2009 Developer and IT Pro Help Is On MSDN


    The big news today is that we’ve released the updated developer and ITPro docs to the Web to make it easier for you to search and find information. You can find the updated docs in the MSDN Library. This update builds on the content that shipped with NAV 2009 and includes new or revised developer, installation, and administration topics around:

    • Security for the RoleTailored client
    • Differences between developing for the Classic client and the RoleTailored client
    • File Handling
    • C/SIDE Reference

    As Claus Lundstrøm blogged about last week, we posted the updated Microsoft Dynamics NAV 2009 documentation for developers and ITPros to the Microsoft Download Center.

    As Claus mentioned in his post, the updates don’t end here. We’re writing new content every day and plan to refresh the Download Center and the MSDN Library about every 3 months. Here’s how you can help us — we need your input on the content that you want to see in the next update. There are a couple of ways you can provide this feedback:

    • If you’re using nav_adg.chm, cside.chm or nav_install.chm, click the MSDN Documentation Feedback link at the bottom of a topic. That sends your request by e-mail directly to our inboxes.
    • If you’re using the MSDN Library, click Click to Rate and Give Feedback in the top right corner of a topic. That sends your rating and content request to a database of requests that we will review regularly.
    • Add a comment to this blog post.

    In addition to the developer and ITPro doc updates, the Microsoft Dynamics NAV 2009 UX Guide is also available from the Microsoft Download Center. The UX Guide is a tool to assist Microsoft Dynamics NAV ISVs in building more user-friendly applications that match the standard Microsoft followed to create the RoleTailored client.


    Bob, Jill, Elona, Susanne (the Microsoft Dynamics NAV 2009 Platform Writers)

  • Microsoft Dynamics NAV Team Blog

    Automation Objects in Microsoft Dynamics NAV 2009



    The Automation object is often used to integrate NAV business logic with external processes and thereby extend the functionality of the product, such as integration with other products like Office. Automation objects must expose a COM interface, and every time we cross a process boundary is worth thinking about performance, but issues that involve correct operation could have a negative impact on performance. This is something we are willing to accept. One example is that objects designed for a single thread execution must execute on Single Threaded Apartment (STA) threads. Having a look at this KB article ( explains why office products never should be allowed to run on the server:

    Reentrancy and scalability: Server-side components need to be highly reentrant, multi-threaded COM components that have minimum overhead and high throughput for multiple clients. Office applications are in almost all respects the exact opposite. Office applications are non-reentrant, STA-based Automation servers that are designed to provide diverse but resource-intensive functionality for a single client. The applications offer little scalability as a server-side solution. Additionally, the applications have fixed limits to important elements, such as memory. These cannot be changed through configuration. More importantly, the applications use global resources such as memory mapped files, global add-ins or templates, and shared Automation servers. This can limit the number of instances that can run concurrently and can lead to race conditions if the applications are configured in a multi-client environment. Developers who plan to run more than one instance of any Office application at the same time need to consider "pooling" or serializing access to the Office application to avoid potential deadlocks or data corruption.”



    Flavors of COM

    Apartment threading

    There are two major flavors of Automation objects, ones that are designed for single threaded applications, and ones that execute well in a multithreaded environment. This doesn’t prevent one from running STA objects on the server and MTA objects on the client, but each scenario where “best practices” are deviated should be considered closely.

    An example would be the XML Document object


    The DOMDocument is a single threaded apartment version and the FreeThreadedDOMDocument is the version that utilizes a multithreaded environment, like the server. But in cases where we a free threaded version of the object is not available, it would properly be acceptable to use the version available, because the .Net runtime is managing MTA-to-STA marshaling behind the scene. This could result in bad performance and other problems – but in most scenarios it is likely to work. A closer look at “PRB: MSXML Performance Bottleneck in ShareMutex Under Stress” explains why issues like these must be considered.

    “Using the MSXML parser in a high-stress environment … may cause unusually long run times on XML requests, and the application or service can appear to stop responding (hang).“

    And the solution in this scenario would be to use the FreeThreadedDOMDocument object on the server.

    Native and Managed Automation Objects

    The Automation implementation in the Role Tailored Client and the Dynamics NAV Server utilizes the CLR implementation, and the CLR does an excellent job of allowing managed code to call out to unmanaged Automation objects. It generates a runtime-callable wrapper (RCW) proxy that implements all of the interfaces of the underlying object. Furthermore, the CLR has a built-in mapping/marshaling layer that knows how to translate the types between the native and managed domains.

    The following table shows the specific type mappings between AL, COM and their corresponding .NET types.


    All the Automation objects are late bound activated; this means that they must implement the IDispatch interface, in order for the Reflection API to be able to invoke members. Managed Automation objects are recognized by the RCW as being managed and standard CLR reflection invocation takes place. Therefore, in-process (dll) and Out-of-process (exe) Automation behaves identically if the objects are created in a managed language.


    The default account for running the NAV Server, configured at installation time, is the built-in Network Service account. This account does not have permissions to spawn a new process, as configured in Component Services, and it is not recommended to change that behavior. This is by design, in order to prevent out-of-process Automation servers (Executables with a COM Interface) to execute on the server. But if the scenario requires this, it would be a recommended practice to create a new service account with the minimum privileges plus the “Launch and Activate Permissions” of the required Automation Servers. These processes will then be created on the server and properly stays alive until they receive a specific terminate command, or the server is rebooted. Another risk with Automation servers on the NAV Server machine is that users could potentially share the same Automation process. In AL, the construct CREATE (automationServer, TRUE), will search the system for created instances of type “automationServer” and try to reuse that process, and potentially read data created by another user.

    Therefore the recommended syntax would be CREATE(automationServer, FALSE, FALSE), for Automation servers running on the NAV Server. On the client tier, no sharing can occur and it would be perfectly fine to try and reuse the Automation server.

    The in-process Automation objects whether they are created on the client or server tier are hosted by the running process and inherit the security context of the active user. The same goes for OCX controls that require an UI and therefore only will be allowed on the client side.

    Wrap-up (recommendations)

    Server tier
      • Native Automation objects: In-process automation servers, like MSXML6.dll.
      • Objects with a user interface such as OCX types.
      • Managed wrapped COM Objects
      • Objects designed for multi threaded execution (MTA)
    Client tier
    • Native Automation objects: Out of process automation servers, like Microsoft Office.
    • Objects with a user interface such as OCX types.
    • Objects designed for single threaded execution (STA)
    • It is good practice to design your Automation interfaces to get as much work done in a single method invocation. And when consuming a component, try to use it in way that minimizes chattiness. This is utmost importance for the client side automation scenario.


    COM is an immutable, interface-based model. Interface design is very important and should always be split from the implementation. Try to avoid auto-generated interfaces based on classes as they have a tendency to violate this guideline and not version well. There is a good source of information at: “Do not use AutoDual ClassInterfaceType“


    (see the first comment on this post for the text of this sample)

    - Stefan Omdahl

Page 38 of 47 (693 items) «3637383940»