Microsoft Dynamics NAV

Team Blog

November, 2009

  • Microsoft Dynamics NAV Team Blog

    Using XMLports With Web Services


    As a follow-up on my recent webcast (found HERE), here is the general walkthrough of how to create an XMLport and use it for sending data to NAV.

    First, what we want to do is create our XMLport and make sure it has the elements and values that we want.


    For the root element, I have set maxOccurs = 1 to avoid any confusion.
    For the general XMLport, the UseDefaultNamespace and the DefaultNamespace values have been edited as seen below.


    Other than that, I have no code on my XMLport, but naturally, anything goes that would work on a regular XMLport. Now to the Codeunit:

    ImportDim(VAR DimImport : XMLport DimImport) Return : Text[30]
    EXIT('Import Run');

    So basically we’re telling the XMLport to run an import and we’re returning to the Web Service that we’ve run. All we need to do now is expose the Web Service using Form 810:


    Remember that the actual name of the codeunit does not have to match that of the service name here.

    So now we move over to Visual Studio and start working with what we have. The first thing we’ll notice is that the WSDL matches our XMLport.


    What we see is both the RootDimensions element which consists of multiple Dimension elements. From there, we can see the definition of the Dimension element the fields we’ve chosen to expose.

    When creating a new project, we will go with a Windows Forms project this time.


    And from there we will start off by adding a web reference to http://localhost:7047/DynamicsNAV/WS/Codeunit/DimensionImport .

    The details on how to add a web reference can be found in the Developer and IT Pro Documentation.

    On my new form, I have created two input boxes for the Code and Name of the dimension and a Create button.


    And then we have the code on the Create button, along with helpful comments:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms; 


        using WSDI; 
        public partial class Form1 : Form 




            public Form1() 
            private void button1_Click(object sender, EventArgs e) 
                //Make sure the ResultLabel doesn't have any text on multiple runs 
                ResultLabel.Text = ""

    //Create a WS reference instance, set credentials and define the company by specifying the URL. 
                DimensionImport NAVImport = new DimensionImport(); 
                NAVImport.UseDefaultCredentials = true
                NAVImport.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS%20International%20Ltd/Codeunit/DimensionImport"
                //First we create our root element 
                RootDimensions RootDim = new RootDimensions();




                //Then we create a List to handle our (possible) multiple dimensions 
                List<Dimension> DimList = new List<Dimension>();




                //And then we create a single dimension 
                Dimension Dim = new Dimension();  


                if (dimInputCode.Text != "" && dimInputName.Text != ""
                    //We assign the values from our textboxes to the single dimension 
                    Dim.DimensionCode = "AREA"
                    Dim.Code = dimInputCode.Text; 
                    Dim.Name = dimInputName.Text;




                    //Then we add the single dimension to our list 


                    //To get the list of dimensions "attached" to the root element, we use the following
                    RootDim.Dimension = DimList.ToArray(); 
                        //Then we send to NAV and show our result 
                        ResultLabel.Text = NAVImport.ImportDim(ref RootDim);




                    catch (Exception ex) 
                        //Show a possible exception 
                        ResultLabel.Text = ex.ToString(); 
                    //Make sure there are values 
                    ResultLabel.Text = "Both values must be filled"

    Our wonderful application is now ready to run and all we have to do is press F5:


    We have now created our XMLport, exposed it using a codeunit and set data into it from a form based application.

    Lars Thomsen

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    How to run 2 RTC on the same pc and connect it to different db (how to run pages/reports from diff db)


    Multiple RTC:
    We know that Dynamics NAV classic client has very nice feature: we can start it with option ID=<zup file name>. In that way we can have many NAV shortcuts which open different db/companies.
    However Role Tailored Client looks like only one shortcut in menu and always starts the same client connected to "last server, last db, last company".

    But we can create shortcuts for every needed connection in similar way as in CC, just we need to use option: settings:<clientusersettings.config file>.
    For example i want to have shortcut which always opens W1 db on server "a1", service "NAV W1", using port 7048 (not standard port). Then:

    • I search for default "clientusersettings.config" in default folder (usually it is C:\Users\...AppData\Local\Microsoft\Microsoft NAV\).
    • Copy it to somewhere - for example to NAV RTC folder and rename to for example "w1.config".  
    • Modify settings file:
      • <add key="Server" value="a1" /> 
      • <add key="ServerInstance" value="NAV W1" />
      • <add key="ServerPort" value="7048" />
    • Create shortcut: "C:\Program Files\<path to RTC>\Microsoft.Dynamics.Nav.Client.exe" -settings:"C:\Program Files\<path to RTC>\W1.config"

    Now when i will click on this shortcut, it will try to connect to service tier described in config file.
    And i can create as many shortcuts as i want and at the same time to have opened many RTC connected to different db.
    Before use this shortcuts i must to create service tiers, but this is not current topic problem, it is described at Freddys Blog

    How to run pages/reports from CC

    During developing pages and SSRS reports in CC objects designer, usually we want to run it. However there are few issues:
    - If we run page (nice feature in Dynamics NAV SP1), it will start last RTC session connection. I mean for example i just looked how page looks in db "w1" by run it from RTC, and now opened CC and designing page in db "UK", and, if i push run button in object designer, then NAV will open RTC and run page from company "w1" (but I'm expecting "UK"). This is because NAV CC has no information about "service tier" and just starts last RTC session.
    - There are no possibilities "by default" to run RTC report from CC.

    With my friends help i created little trick and can run page/report from CC from current connected db.

    1. I created table with fields:
      1. User ID Code 20 - user id which will run page/report (for example: gediminb)
      2. RTC Client exe Text 250 - path and name to RTC client exe file (for example: C:\NAV RTC\Microsoft.Dynamics.NAV.Client.exe)
      3. Server Name Text 30 - NAV server name (where is service tier installed) (For example "DBServer")
      4. NAV Server Name Text 250 - NAV service tier name (for example: NAV W1)
      5. Settings  path+name Text 250 - path and name of client user settings file (i described earlier) (for example: C:\NAV RTC\w1.config)
    2. I created form based on "Object" table, filtered pages and reports and under button i added code:

    Session.SETRANGE("My Session",TRUE);

    WITH DevUserSetup DO BEGIN
      GET(LoginMgt.ShortUserID(Session."User ID"));

      TESTFIELD("Server Name");
      TESTFIELD("RTC Client exe");
      TESTFIELD("NAV Server Name");

     IF DELCHR(DevUserSetup."Settings  path+name")=''
        THEN txtSettings := ''
        txtSettings:='-settings:"'+DevUserSetup."Settings  path+name"+'"';

      ShellString := '"' + "RTC Client exe" + '"';

    IF Rec.Type=Rec.Type::Page THEN
      ShellParam := '"DynamicsNAV://' + "Server Name" + '/' +
                    "NAV Server Name" + '/' + COMPANYNAME + '/' +
                    'RunPage?Page=' + FORMAT(Rec.ID) + '" '+txtSettings;
    IF Rec.Type=Type::Report THEN
      ShellParam := '"DynamicsNAV://' + "Server Name" + '/' +
                    "NAV Server Name" + '/' + COMPANYNAME + '/' +
                    'RunReport?Report=' + FORMAT(Rec.ID) + '" '+txtSettings;




    Here "DevUserSetup" is variable type rec and point to my previous created table.

    So what does this code when i push button when cursor is on report 21? It creates string like: "c:\NAV RTC\Microsoft.Dynamics.NAV.Client.exe" "DynamicsNAV://DBserver/NAV W1/CRONUS International Ltd./RunReport?Report=21" -settings:"c:\NAV RTC\W1.config" and run it from SHELL.
    This will run RTC and opens report i want to see with data i want to look.
    The same is if i push button when cursor is on page.

    That's all
    Special thanks to Martin Jordt Hansen

    Gedas Busniauskas (gediminb)
    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    Best Practices Analyzer for Microsoft Dynamics NAV 2009


    The Best Practices Analyzer for Microsoft Dynamics NAV 2009 is a tool for identifying issues that can prevent you from successfully deploying a three-tier environment of Microsoft Dynamics NAV 2009.

    Three-tier environment deployments can be challenging because they often require additional domain administration tasks. The Best Practices Analyzer for Microsoft Dynamics NAV 2009 queries various sources and produces reports that can help you diagnose issues with your deployment.

    The Best Practices Analyzer for Microsoft Dynamics NAV 2009 performs the following verifications:

    • Verifies that an appropriate version of Microsoft Dynamics NAV Server is installed. Only Microsoft Dynamics NAV 2009 SP1 is supported.
    • Verifies Microsoft Dynamics NAV connection strings.
    • Verifies that the Microsoft Dynamics NAV Server service, the Microsoft Dynamics NAV Web services service, and the SQL Server service are running.
    • Checks database permissions to make sure that the required resources can connect to the database.
    • Verifies that the necessary service principal names (SPN) have been created and correctly configured on the account that is running the Microsoft Dynamics NAV Server service.
    • Verifies that constrained delegation has been configured.

    You can find more information about the tool and download it from CustomerSource here:

    or from PartnerSource here:

  • Microsoft Dynamics NAV Team Blog

    Application Test Toolset for Microsoft Dynamics NAV 2009 SP1


    The C/AL Application Test Toolset for Microsoft Dynamics NAV 2009 SP1 is now available on PartnerSource. This toolset helps NAV developers to quickly develop and run C/AL-based tests in their primary development environment.

    The toolset includes sample tests to help you get started with C/AL test development, tools for test case management and execution, and useful test library functions, such as assert and database state restore.

    These tools build on top of the Test Features released with Microsoft Dynamics NAV 2009 SP1.

    Download from PartnerSource

  • Microsoft Dynamics NAV Team Blog

    Warehousing Improvements in NAV 2009 SP1


    If you utilize some of the warehousing functionality - you have several reasons to look after 2009 SP1!

    While improved productivity - for customers and partners alike - is one of the main benefits of Microsoft Dynamics NAV 2009, we continue to focus on quality. We strive to make improvements in the product application with every release. Microsoft Dynamics NAV 2009 SP1 is no different. NAV 2009 SP1 provides application enhancements to address customer and partner requests including the correction of up to 170 different issues in Warehousing. Some of these include fixes, redesign or consolidation in the following three areas:

    1. Warehouse Granularity - The granularity in the Warehouse offering is an important characteristic of the feature - with five separate granules and a potential of 121 combinations that can be chosen. The flexibility of choice supports the concept that the warehouse offering in Microsoft Dynamics NAV can fit your business requirement and the granularity allows the system to grow with the company. We had an increasing number of customers who were utilizing this flexibility and some of the combinations that were used were unexpected and further development was necessary to consolidate the usage of these combinations. For example, some cases concerned the combination of all warehouse features except directed pick and put-away (a manual WMS) that is used frequently at installation before switching completely to a full-fledged WMS. Other cases related to a very simple combination with inventory pick or put-away without bin.
    2. Multiple Unit of Measures - Microsoft Dynamics NAV 2009 SP1 now supports multiple units of measures. For example, this makes it possible for a company to buy in tons and sell in meters and the quantities in both the company's inventory and warehouse will be synchronized and consistent. So, it's possible to calculate the availability of goods when shifting units of measure. This gives companies greater flexibility as they can change the unit of measure on the fly. This eliminates new specific warehouse rounding issues originating by handling the UOM differently than in the inventory.  The need for manual adjustments to handle rounding residuals is reduced dramatically. All of this saves users time and companies money.
    3. Partial Scenarios with Item Tracking - Several issues have been solved involving Item Tracking, including an issue where an order reservation could be deleted with partial posting. Order information is now sustained even when the order is deleted or only part of an order is shipped. This gives users more reliable information and enables customers to receive partial shipments without the risk of the company losing their order.

     Headlines of some of the fixes are added here:

    • Item Tracking Information Card - Lot No. Blocked field added to the warehouse activity lines in order to inform about the lot information card status of the blocked field.
    • Partial pick cannot be create directly from the sales order when using Whse shipment and the shipment advice is set to Ship complete on the customer card, an explanatory error message will be issued to the user, in case the user want to create the whse shipment to start a partial picking process, the whse shipment can be created and retrieving the sales order (in short: the push scenario is blocked with a new warning while the pull scenario still works)
    • You can use Filters to Get Src. Docs and avoid entries for Customers that are Blocked with Type 'Ship'; the batch job is now resilient and outbound lines are now retrieved even if some lines has a customer blocked with type "Ship"
    • Function Explode BOM does maintain reservation field on Sales Order Lines
    • The expected receipt date is calculated properly respecting the planned receipt date entered on the purchase order as well as the whse handling time
    • The auto-reservation feature is resilient when an user change Item No. on sales line
    • Various issues with Transfer Order and Item tracking (qty ship =0 generate an issue, reservation and lot tracking info in an order-to-order scenario, adjustment of reservation when adjusting qty) were fixed
    • FEFO and location with directed pick and put-away fixes (when using UOM>base UOM (Unit Of Measure) only one bin was considered, Bin Replenishment in the Movement Worksheet did not correctly use the First Expired First Out (FEFO) rules when creating the Movement request, The expiration dates did not appear on the Whse pick when assigned on the sales order)
    • Reservation and Item Tracking (Reservation Entries were incorrectly updated when partially picking inventory in a Directed Put-away and Pick Location)
    • Ability to ship specific serial numbers when everything is picked. The "Qty. to Handle (Base)" field on the item tracking lines was non-editable, and therefore you could not choose which ones to ship. The "Qty. to Handle (Base)" field is now made editable for situations where item tracking is handled with whse.
    • Next counting period field on Item card, Item (and SKU) are now updated if Physical Inventory Count feature is used to create physical inventory journal lines (both Warehouse and Item Physical Journal).
    • Wrong update of shipment date in sales order, the Shipment Date on Sales Order will only be update when Whse Shipment is fully shipped.
    • Pick worksheet had issues with qty to handle and Qty outstanding in partial scenario involving Serial Numbers.
    • When sales UOM > UOM in Whse, the highest ranking bin containing the item was suggested on pick, no matter if it contained the LOT as specified on the sales order. The Lot/SN filter were not used in the relevant code unit - this is now fixed.
    • Wrong Pick quantity were calculated when items were at multiple bins and using lot tracking and order tracking reservation.
    • Reservation entries are removed and users do not really know the impact on changing "Shipment Date" on the header. The mechanism has been re-implemented so that reservation entries are recreated correctly.
    • Tracking information created on a sales order were not deleted when the sales order line was.
    • Poor Performance on Get Bin Content function when using Lots, this has been fixed.

    -Philippe Jacobsen

  • Microsoft Dynamics NAV Team Blog

    Duplicate SPNs in a 3-tier setup and how to locate them


    One of the problems when troubleshooting why a 3-tier setup of NAV 2009 doesn't work is, that the same error - typically this one on the SQL Server:

    "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'"

    can be caused by any number of problems between NAV Server, SQL Server and Active Directory settings.

    One quite common cause of this problem is duplicate SPNs. This post describes the problem with duplicate SPNs, and how to locate and solve it.


    What is the problem:

    When the NAV Server and SQL Server are on two different machines, a connection between Role Tailored Client (RTC) and the NAV Server requires Kerberos. Kerberos uses SPNs to locate which Windows account the NAV Server is running under. For this reason, each SPN must point to exactly one Windows account.

    Once you start setting up and troubleshooting a 3-tier setup it is easy to end up trying new SPNs on new accounts, and forgetting to remove the original SPNs. And you may end up with the same SPN assigned to two different Windows accounts. More about SPNs in this post:

    What do SPNs actually do - NAV 2009


    How to check if you have duplicate SPNs:

    This is easy if you have Windows 2008 somewhere on the domain. If you do, then from a command prompt, just run this command:

    setspn -X

    This command is new in Windows 2008, and was introduced exactly and specifically to help locating this problem.


    If you do not have Windows 2008 anywhere on the domain, then use the command line tool called "ldifde" from a Windows Server 2000 or 2003. More details and examples about ldifde in this KB article:

    LDIFDE - Export / Import data from Active Directory - LDIFDE commands


    For the purpose of finding duplicate SPNs, use ldifde from a command prompt like this:

    ldifde -f "c:\x\AD.txt" -l ServicePrincipalName

    This will export values of the ServicePrincipalName-property for all accounts in Active Directory to a text file. Here is an example of the output of this command:

    dn: CN=navservice,CN=Users,DC=contoso,DC=com
    changetype: add
    servicePrincipalName: HTTP/NAV-SERVER
    servicePrincipalName: HTTP/
    servicePrincipalName: DynamicsNAV/NAV-SERVER:7046
    servicePrincipalName: DynamicsNAV/

    dn: CN=SQLDUI SD.,CN=Users,DC=contoso,DC=com
    changetype: add
    servicePrincipalName: DynamicsNAV/NAV-SERVER:7046
    servicePrincipalName: DynamicsNAV/

    Then you must search manually for your SPNs, and see if they appear more than once. In this example, the SPN "DynamicsNAV/NAV-SERVER:7046" is set up for both accounts navservice and SQLDUI, so in this case you would have to remove this SPN from one of the accounts.



    Lars Lohndorf-Larsen

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    Mainstream Support for Microsoft Dynamics NAV 4.0 Ends January 12, 2010

    Mainstream support for Microsoft Dynamics NAV 4.0 will end January 12, 2010 per the Microsoft Support Lifecycle Policy. Customers who are current on a service plan can continue to access the following benefits through CustomerSource.
    • Previously released Upgrades, Updates, Service Packs, Fixes and Regulatory/Tax Updates
    • Self-Help Support through Knowledge Base articles and online content
    • Unlimited Online Training
    • CustomerSource Community and Tools
    For more information related to Microsoft Support Lifecycle policies and associated product dates for all Microsoft Products see the Support Lifecycle page

  • Microsoft Dynamics NAV Team Blog

    How To Install Microsoft Dynamics NAV 2009 SP1 Employee Portal on a 64-bit Operating System


    "How To" article describing how to install the Microsoft Dynamics NAV 2009 SP1 Employee Portal on a 64-bit Operating System has been published on Partner Source*.

    Note: After downloading the .zip file rename it to .docx
    *Login is required to access Partner Source.

    Mohamad Vajid (mvajid)
    Microsoft Dynamics ME
    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    How would I use RIM and Style Sheet Tool to handle change of Tax Number (OiB) in Croatia (Part 1 of 3)


    Here's the problem... Tax number for all companies is being changed in Croatia. This means a lot of hassle collecting new tax numbers from your customers, vendors and contact to ensure seamless opereation when it becomes mandatory to use. Specially, tax reporting for December needs to be done using old tax number and you need to start using new in your accounting from 1.1.2010. Nightmare in this holiday time of year you'd like to spend with family and friends. So, I thought, why not using what you already have in Dynamics NAV? RIM's Data migration tools? Style sheet tool?

    Some logistics first, before I get started.

    Currently, we have 2 versions of Dynamics NAV supported in Croatia (NAV 4.0 SP3 and NAV 5.0 SP1 with Feature Pack 1). Rapid Implementation Methodology Toolkit (RIM Toolkit), which is now part of Sure Step methodology, is localized and available for both of these versions on Dynamics NAV.

    From July 2009, RIM Toolkit (part of Sure Step Methodology) is available to all partners, so why not taking advantage of this tool?

    For Croatian version of Dynamics NAV 4.0, there was a separate release of localized RIM Toolkit (download link).

    Localized RIM toolkit is available as integral part of latest Croatian version of Dynamics NAV release (download link for NAV 5.0 SP1 FP1).

    Style Sheet tool is also available for download from this link. I used Style Sheet Tool version 1.1 while preparing this guide.

    At the moment new tax number regulations were published (OiB), it seemed to me, users will only have to replace current VAT Registration Number with new tax number Tax Authority will supply them with. Apart from updating their own VAT Registration number, users will have to do this for their master data (Customers, Vendors and Contacts) and open documents (orders, invoices and credit memos) as well. However, from conversations I had with partners, most trouble customers will have will be the transition period where they still need to do reporting with old VAT Registration No, while at the same time create new documents with new tax number, that, as per legislation, has clear usage cut-off date - 1.1.2010.

    Handling VAT Registration No update process out of the system should enable users do their day to day business in with no interruptions, keeping their customer, vendor and contact data in structured format, out of the system, until new tax numbers are collected. When users receive new tax numbers from their customers, vendors and contacts they will update data prepared by RIM toolkit and import it back in the system (on 1.1.2010). RIM toolkit will ensure validation logic is executed over changed data.

    On the other hand Style Sheet Tool will enable users prepare documents to send to customers, vendors and contacts to collect their new tax numbers (OiB).

    Business process from customer perspective looks like this:

    1. Export customer, vendor and contact data from Dynamics NAV to Excel file
    2. Request customers, vendors and contacts for their new tax number using documents created with help of Style Sheet Tool
    3. Enjoy the year end holidays with friends and family
    4. Update data exported in step 1 with new tax number received from customers, vendors and contacts and import it back in Dynamics NAV

    Over the next few weeks, I will post parts 2 and 3 in this series, which describe these four steps.

     -Ivan Koletic

  • Microsoft Dynamics NAV Team Blog

    Transformation Tool under the Covers: Enable on Controls


    When coding for Forms it is a common pattern to enable (or disable) controls based on values elsewhere on the Form. For example, a design may require that the ‘SEND' button is disabled until all fields are filled in and contain valid data.

    In this post, I examine a simple Form and the Page output as generated from the Form Transformation Tool. To illustrate, I create a simple Form based on the Languages Table (Table 8) with no tabs and two fields, Code and Name. I've added a command button and the form looks like this when the language name is not equal to English:


    And like this when the language is English:



    To achieve the behaviour, I add the following code to the form:

    Form – OnAfterGetRecord() Trigger

    IF (Rec.Name = 'English') THEN BEGIN




    When I run this form, I can iterate through the records and when I hit English, the Command button becomes enabled.

    After using the Form Transformation Tool generating a Page, I compile and run the page. The output looks like the Page below and the functionality works. Here is a screenshot where the CommandBtn control is not enabled.


    Here is a screenshot where the CommandBtn control is enabled.


    It’s a bit more subtle than the Form but you can see the button is greyed out when not enabled.

    On the Page the C/AL code has changed to:

    Page – OnInit() Trigger

    CommandBtnEnable := TRUE;

    Page – OnAfterGetRecord() Trigger

    IF (Rec.Name = 'English') THEN BEGIN

      CommandBtnEnable := FALSE ;



      CommandBtnEnable := TRUE;

    Under the covers, the CommandBtn.Editable has been mapped from a property that can be set in code to a global variable named CommandBtnEnable. This global variable is included in the data sent from the NAV Server to the RTC – this is visible from the property IncludeInDataset.


    The Form transformation tool created the variable with IncludeInDataset, created the initializing code in the Page OnInit() trigger and assigned the global variable to the Enabled property in the CommandBtn action.

    Rather than setting the property directly on the control, the RoleTailored Client exposes this functionality through a global variable and binds the property value to it. The advantage of this is that even simple properties needn’t be restricted to Yes/No values but can instead be evaluated in a more complex expression from C/AL. In the case above, we use TRUE and FALSE but it could also have been an expression with multiple components that evaluate to the TRUE or FALSE logic. This expression can be shared amongst controls so you need only set a single variable to control any number of controls on a page.

    Note that this article describes the behavior of the enabled property and Command Buttons. Although in the C/SIDE Classic Client similar behaviour may be observed with Menu Buttons, during transformation Menu Buttons are transformed to the Action Menu which does not support the Enabled property.

    - Stuart Glasson

  • Microsoft Dynamics NAV Team Blog

    Feature Enhancements Documents for Microsoft Dynamics NAV 2009


    The feature enhancements documents for Microsoft Dynamics NAV 2009 describe the enhancements to Microsoft Dynamics NAV 2.60 through 4.0 that are included in Microsoft Dynamics NAV 2009.

    The feature enhancements are categorized by granule ID. This will show the new features added to granules customers have already purchased and aid customers and partners in the upgrade process to Microsoft Dynamics NAV 2009.

Page 1 of 1 (11 items)