Microsoft Dynamics NAV

Team Blog

August, 2013

  • Microsoft Dynamics NAV Team Blog

    What is the NAV Design Patterns project?


    A team of people interested in NAV application design has come together to work on naming and surfacing design solutions to common NAV business needs. When those solutions are generic enough to be applied in various places of the NAV application, with slight variations on implementation but mainly respecting the same base concepts, we can describe them as NAV design patterns.

    Some benefits as we saw them:

    • have a common language
    • understand and explain the concepts behind the inner workings of NAV
    • enhance productivity (as developers don't have to re-invent the wheel )
    • promote best practices
    • become aware of areas of NAV implementations which can be improved, and why.

    Note: it is not our goal to create generic, product and language-independent software development design patterns, as described by the Gang of Four and other authors over the time. Although the idea of a NAV design pattern remains closely related to the generic concept, our hope is to give a name and show to the world only the NAV specific patterns, which are particular to the C/AL language and to the NAV business models and scenarios.

    Some of the patterns describe what is old and already used several places in the NAV application code. Some other patterns will be future oriented trying to push the NAV development style towards new and better practices.

    So far, the core of this team is half-community (special thanks to the Partner-Ready Software team) and half-Microsoft software engineers.

    Eric Wauters

    iFacto, PRS

    Gary Winter

    agiles, PRS

    Mark Brummel

    Brummel Dynamics Services, PRS

    Claus Lundstrøm


    Karolak, Natalie


    Abshishek Ghosh


    Anders Larsen


    Bardur Knudsen


    Bogdan Sturzoiu


    Bogdana Botez


    Elly Nkya


    What to expect next?

    So far we've been meeting to work on identifying and documenting new design patterns - as well as trying to better define the concept of a design pattern in a NAV context. As we go on, we will come closer to understanding what is the correct way to go. Until then, we're focusing on making new patterns available to the NAV developers (on our blogs, at conferences like 2013 Directions US and EMEA and NAVTechDays). The team is open - if you want to add your patterns to the collection, to receive our review or contribute, contact us. Your ideas, especially on what can be improved as well as your expectations are very valued - let us know (either by replying to the blog post, or by writing to us.

    Our latest workshop on August 26th and 27th at Microsoft Development Center Copenhagen:

    Note: we plan to publish patterns on a "best effort" basis - meaning that there will be no pre-established cadence, but we will focus on keeping the continuity and adding new patterns. To reflect this, we'll drop the "pattern of the week" title.

    Best regards,

    The NAV Patterns Team

  • Microsoft Dynamics NAV Team Blog

    Get Ready for Cash Management in Microsoft Dynamics NAV 2013 R2!


    It’s true! The coming release of Microsoft Dynamics NAV 2013 R2 delivers new exciting features to support cash management business processes for our SMB customers and prospects.

    Why Cash Management?

    Cash management is a critical part of any business operation. Business managers need to manage their cash flow, payments and debt collections quickly and efficiently to ensure the company’s financial stability, solvency and ultimately profitability.

    Our SMB customers need more support for basic cash management processes; therefore, we are increasing our focus on cash management in the coming releases of Microsoft Dynamics NAV – beginning with Microsoft Dynamics NAV 2013 R2.

    What’s new in the coming release?

    Microsoft Dynamics NAV 2013 R2 will deliver new functionality to support bank integration with two core scenarios:

    1. Bank Reconciliation
      New capabilities include the possibility to import bank statements, reconcile bank statements with automatic matching, and apply and post incoming payments to open receivables and payables.
    2. Payments
      With Microsoft Dynamics NAV 2013 R2, it will be possible to handle in and outgoing payments automatically with credit transfers and direct debit capabilities.

    What about SEPA support?

    SEPA, what?

    SEPA, or the Single Euro Payments Area (SEPA) is an EU payment-integration initiative of the European Union. Its purpose is to simplify today’s fragmented national payment systems with a single set of standards. It enables organizations and individuals to make payments or bank transfers in euro to anyone within the area through their existing bank account using standardized payment instruments. SEPA will give companies the possibility to connect with more banks and help to shorten payment transfer times. As of March 2012, SEPA consists of the 28 EU member states, the four members of the EFTA (Iceland, Liechtenstein, Norway and Switzerland), and Monaco.

    Microsoft Dynamics NAV 2013 R2 will provide support for SEPA in the following ways:

    • SEPA will be supported in all versions of Microsoft Dynamics NAV prior to Microsoft Dynamics NAV 2013 R2 in countries that already had support for SEPA or other bank formats.
    • Microsoft Dynamics NAV 2013 R2 will provide standard SEPA support in the W1 version. Tools will be provided for partners to easily make small customizations to meet local country and customer requirements.

    More information about Cash Management in Microsoft Dynamics NAV is coming soon on the NAV Team Blog, Yammer, MSDN, Directions and more. Stay tuned!


    Your Cash Management Team

  • Microsoft Dynamics NAV Team Blog

    Update Rollup 5 for Microsoft Dynamics NAV 2013 has been released


    Today we have released update rollup 5 for Microsoft Dynamics NAV 2013 (Build 35201).

    Update rollup 5 includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2013. Local hotfixes for Australia and New Zealand have been added to update rollup 5 and the update rollups now include hotfixes that apply to all countries and hotfixes specific to the following local versions:

    • AU – Australia (NEW)
    • DE - Germany
    • DK - Denmark
    • FR - France
    • IT - Italy
    • NA – North America
    • NL – Netherlands
    • NZ – New Zealand (NEW)
    • UK - United Kingdom

    Where to find update rollup 5

    You can download update rollup 5 from KB 2872273 - Update Rollup 5 for Microsoft Dynamics NAV 2013 (Build 35201).

    The hotfixes that have been released since update rollup 4 are listed in KB 2872273. For a full list of all hotfixes included in update rollups, see the following CustomerSource and PartnerSource pages:



    More Information

    For more information about update rollups for Microsoft Dynamics NAV 2013, see Announcement of new hotfix process for Microsoft Dynamics NAV 2013.

  • Microsoft Dynamics NAV Team Blog

    NAV Pattern of the week: Silent File Upload and Download


    The Reusable Dynamics NAV Patterns is a joint initiative between the NAV team and NAV partners. This is an open initiative to anyone who has documented design patterns which are specific to NAV, please reach back to us either by leaving a comment here, or by writing to us. The NAV Pattern of the week will be taking a summer break during the rest of August, but we’ll be back with new patterns in September.

    Silent File Upload and Download

    This pattern is about silently handing file transfers between NAV Service Tier and the NAV client. By "silently" we mean: without showing a dialog box at upload or download time.

    Know the Pattern

    As a terminology clarification [1], note that both “upload” and “download” are named as seen from the client's point of view:

    • Download” defines transferring a file from the server to the client.
    • “Upload” transfers the file from the client to the server.

    Sometimes, files must be transferred to or from known locations without triggering file-save or file-load dialogs.

    In the following, both the historical and the recommended ways of silently transferring files are described. Since we keep both implementations possible for the sake of backward compatibility, we strongly recommend that you use the file-transfer API provided that is provided with the File Management codeunit (419).

    The legacy API for file transfers [2]:

    [Ok :=] UPLOAD(DialogTitle, FromFolder, FromFilter, FromFile, ToFile)                                                      

    [Ok :=] DOWNLOAD(FromFile, DialogTitle, ToFolder, ToFilter, ToFile)

    As you can see, this historical API leaves no place for turning off the functionality for showing a dialog. Historically, NAV offered a remedy to this, namely by using the "Magicpath" string, which is the constant '<TEMP>'. Under this condition, the way to invoke silent file upload or download becomes:

    [Ok :=] UPLOAD(DialogTitle, Magicpath, FromFilter, FromFile, ToFile)                

    [Ok :=] DOWNLOAD(FromFile, DialogTitle, Magicpath, ToFilter, ToFile)

    This remedy introduced an issue: If we use "Magicpath" instead of FromFolder and ToFolder specifications, then where do we upload from and where do we download to? The answer is that they are uploaded to and downloaded from the NAV server's temporary folder. The path to the temporary file can be obtained when this file is created, by using the following function in File Management: <tempFileName> := ServerTempFileName(<fileExtension>).

    The new API for file transfers in the File Management codeunit:

    [Text :=] UploadFileSilent(ClientFilePath)

    [Text :=] DownloadTempFile(ServerFileName)

    Using the API in the File Management codeunit instead of the historical API is recommended for all file transferring and file management in NAV implementations.

    Use the Pattern

    The following describes a scenario for the silent file upload/download pattern, both from the user’s point of view and from the NAV developer’s point of view.

    The NAV User

    The production manager at CRONUS needs an XML file in a specific format containing his latest product list with description, prices, and quantities. He wants to import the list into his web shop to keep product information updated with data in NAV.

    The production manager wants to have the file in a predefined location on his hard drive. The location has been defined in a NAV setup table.

    The NAV Developer

    The NAV developer has written a module to query the CRONUS database and to export the product list in the pre-described XML format required by the web shop. He saves the data in a temporary server file created with this code:

    ServerFileName := FileManagement.ServerTempFileName('xml');

    When the file has been populated with the latest product data, the NAV developer uses the following call to download the file from the temporary location on the server to the predefined location on the client:


    The call to DownloadToFile is part of the File Management codeunit, and it embeds the silent download offered by DownloadTempFile:

    DownloadToFile@13(ServerFileName@1002 : Text;ClientFileName@1000 : Text);

    TempClientFileName@1001 : Text;

    TempClientFileName := DownloadTempFile(ServerFileName);



    1. Even today, there is no fully silent up or download. The user will get a warning stating the system is trying to run a client side .NET component. However when dismissing this warning, the user can show to not see it again.
    2. Due to client side .NET interop and of security concerns, silently downloading/uploading files on the web is disabled. Therefore, this pattern is recommended for implementation with Windows clients only.



    Best regards,

    The NAV Patterns team


  • Microsoft Dynamics NAV Team Blog

    Microsoft Dynamics NAV 2013 SharePoint client installation moments


    Just few words about Microsoft Dynamics NAV Portal Framework installation.

    Really installation is simple and straight forward. Usually just click setup.exe on installation DVD, choose install SharePoint portal framework, set few parameters and next,next, next…
    Simplest scenario described at
    How to install framework on multiple computers described at

    And usually everything goes OK except cases when something happened during installation and ERROR: ‘Package Language Module (en-GB) for Microsoft Dynamics NAV Portal Framework failed with error.’ comes.
    Here mentioned language can be any and depends on what language users tries to install.

    People thinks this error means that only language failed to install because some components are installed, but really this message is very general error and means that NAV Portal framework installation failed and do not explain why it is so.
    One of reasons could be described at described solution could help. If solutions doesn’t help, do next steps:
    1. Uninstall NAV Portal Framework using the same NAV installation DVD – choose remove components and remove portal.
    2. Go to DVD > SPC server and start Portal.msi. This will start directly portal installation and probably will show real reason like: ‘Unable to access local SharePoint farm’ or even finishes success.
    3. Now we know what to do further: analyze what is error about and fix situation, or if everything ok then go to DVD>Installers>DE [or another language]>SPC>

    Most of issues during installation came from users permissions: does account have enough permissions to SharePoint farm, to SharePoint database on SQL, does account under NST service have permissions to SQL SharePoint database and etc. Please check that at first…


    These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.


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


  • Microsoft Dynamics NAV Team Blog

    NAV Patterns of the Week: No. Series


    The Reusable Dynamics NAV Patterns is a joint initiative between the NAV team and NAV partners. This is an open initiative to anyone who has documented design patterns which are specific to NAV, please reach back to us either by leaving a comment here, or by writing to us. Last week's pattern got delayed a bit, but here you go at last.

    No. Series

    Number series assignment is widely used in Microsoft Dynamics NAV to automatically assign unique numbers to data entries.

    Know the Pattern

    Documents and entities of any type (invoices, orders, customers, inventory items etc) are usually assigned an unique number, which can be later referenced whenever that particular entry needs to be consulted. When a new data entry is created, NAV implements the possibility to auto-assign a new number for this entry. For example, whenever a new sales order is created, it can be auto-numbered. This number has a specific format which is set up previously by the NAV administrator. For example, sales orders could have numbers between SO00001 and SO99999. When all the numbers in this series have been used, NAV will show an error and the administrator has to either extend the current number series, or create a new series to be used.

    Use the Pattern

    The number series is implemented at the table level. Each time a new record is inserted, the user can either:

    • type a new number (if allowed by the setup), or
    • have an auto-generated number created.

    Number Series definition

    From the implementation point of view, a number series is a record in the table 308 - "No. Series".


    The most relevant fields are:


    Code 10

    Used to identify the number series in further places where it will be used.

    Default Nos.


    The boolean Default Nos. decides whether this number series can use automatic numbering. If false, then the user is expected to manually look up the No. field and select it from the number series.

    Manual Nos.


    If the Manual Nos. is Yes, then the used will be allowed to manually type the value of the next number ("No.") field.

    Date Order


    Date Order is used to decide whether or not the numbers from the range are assigned chronologically.

    Number Series sequence

    The sequence definition is found in table 309 - No. Series Line. Contains the explicit definition of the series, for example a series called BANK, could start with BANK001 and increase incrementally by one, in the  sequence BANK001, BANK002, BANK003, .... Until the last number BANK999. When hitting the number BANK990, the user will receive a warning that the series is about to be exhausted and it must either be  increased, or a new series should be assigned.

    The most relevant fields are:

    Series Code

    Code 10

    Links it to the number series defined in table 308.

    Starting No.


    This is the first number in the sequence, for a book indexing application it can be BOOK0001.

    Ending No.


    The last number in the sequence, for example BOOK5000.

    Warning No.


    When this number is reached, the user will see a warning message stating that the number series is running out of assignable numbers.

    Increment-by No.


    The value for incrementing the numeric part of the series.

    Last No. Used

    Code 20

    The last number from the sequence that was assigned.

    Last Date Used


    Stating when the last number was assigned.

    Add the default number series to the setup

    Various series of numbers can be defined as seen above. For example, a library can have a number series for indexing rental of each of the following: books, movies, music, video. The books series can be split by domain, for example a series BOOKSCIFI can have BOOK0001...BOOK1500, then BOOKTECH can use the sequence BOOK1501...BOOK4000 and so on.

    The default number series for a certain application area is typically stored in the domain setup table. For example, NAV Demo Database stores the default Item number series in the Inventory Setup table 313. This means that you will need to add the Number Series fields in your setup table and ensure that before the customer starts using the solution, the number series is created and added to the setup defaults.

    How to use the Number Series

    The table which will host the number from the number series, needs the following fields:


    Code 20

    Contains the auto-generated sequential number.

    No. Series

    Code 10

    The number series definition, which decides what the next No. will be.

    And the code to make the number series alive:


    IF"No." = '' THEN


    Field "No."

    No. - OnValidate()
    IF "No." <> xRec."No." THEN BEGIN
      // Validate that "No." corresponds to the current No. Series rules
      "No. Series" := '';


    AssistEdit() : Boolean
    IF "No." = '' THEN


    • DefaultNoSeriesCode is typically found in the application domain setup table.
    • OldNoSeriesCode is typically the previous value of the "No. Series" code, which is found in xRec."No. Series"
    • NewDate is typically 0D (empty date)
    • NewNo and NewNoSeriesCode are the current values found in "No."  and "No. Series"

    NAV Implementations

    See below an example of how NAV implements the number series pattern.

    Sales and Receivables

    The setup table 311 (Sales & Receivables Setup) contains the default number series to be used in the whole application domain. In the demo data, some of the series defined here are: Customer Nos., Quote Nos., Order Nos., Invoice Nos., Posted Invoice Nos., Credit Memo Nos., Posted Credit Memo Nos., etc. Those number series are dimensioned for the needs of a typical small to medium sized company, however, various business have different patterns (for example, posting an unusual high number of invoices). In this case, the number series should be adjusted accordingly to make space for the customized company needs.

    The default number series defined in the setup is then used in the individual tables. For example, table 18 - Customer, has

    Field "No."

        { 1   ; ;No. ;Code20  ;AltSearchField=Search Name;
               IF "No." <> xRec."No." THEN BEGIN
                 NoSeriesMgt.TestManual(SalesSetup."Customer Nos.");
                "No. Series" := '';
              IF "Invoice Disc. Code" = '' THEN
                "Invoice Disc. Code" := "No.";


    Field "No. Series"

        { 107 ;   ;No. Series ;Code10 ;TableRelation="No. Series"; Editable=No }



    PROCEDURE AssistEdit@2(OldCust@1000 : Record 18) : Boolean;
      Cust@1001 : Record 18;

      WITH Cust DO BEGIN
        Cust := Rec;
        SalesSetup.TESTFIELD("Customer Nos.");
        IF NoSeriesMgt.SelectSeries(SalesSetup."Customer Nos.",OldCust."No. Series","No. Series") THEN BEGIN
          Rec := Cust;




      IF "No." = '' THEN BEGIN
        SalesSetup.TESTFIELD("Customer Nos.");
        NoSeriesMgt.InitSeries(SalesSetup."Customer Nos.",xRec."No. Series",0D,"No.","No. Series");



    Best regards

    The Reusable Dynamics NAV Patterns team

  • Microsoft Dynamics NAV Team Blog

    PAGE.RUNMODAL actions change in Dynamics NAV 2013


    In Dynamics NAV 2009 page.RUNMODAL can have actions OK, Cancel, LoookupOk, LookupCancel, Yes, No, Close, FormHelp, RunObject, RunSystem. Like it is described at you can create code like:
    IF Page.RUNMODAL(21, MyRecord, ...) = Action::Close THEN...;

    But in Dynamics NAV 2013 actions list is changed to OK, Cancel, LookupOK, LookupCancel, Yes, No, RunObject, RunSystem ( ).
    As you see there is no action ‘Close’. Means if we have code based on this action this code will never be executed.

    Action ‘Close’ can’t be used in NAV 2013 because with web client in browser we can’t catch what action user does: close page or close browser.

    I'm writing this article because we can import objects from previous NAV versions and then can run it.

    Before NAV 2013 build 34588 we could compile these objects but during run it’s showed errors.
    With fix KB 2836619 compiler shows error here and now we need manually change to action we really want or even we need to change application workflow, because we have no real replacement for ‘Close’.

    So be ready to rewrite your code.

    These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

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

  • Microsoft Dynamics NAV Team Blog

    Memory usage in Microsoft Dynamics NAV 2013 print preview


    Periodically we receive requests where customers asking us about RTC print preview consumes all available memory and computers hangs.

    Repro scenarios are more/less similar: run report, click preview, go per pages up/down, close report. Run another report, click preview, go per pages up down and… RTC hangs.
    If we look to memory usage, NAV is using all available memory.

    If we analyze what has happened, we see: with every move per pages memory usage increase and increase and increase until all memory is used.
    It looks like typical memory leak because in NAV 2009 with the same repro everything is OK.

    However it is not so simple. What NAV does in this scenario is: it loads Microsoft Report Viewer 2010 with 2 files: report definition (RDL file where is described report structure) and record set. And that is all, next actions like preview/print/export are managed by report viewer. The same we have in NAV 2009 just it loads Report Viewer 2008 and .NET Framework 3.5 as NAV 2013 uses Report Viewer 2010 and .NET Framework 4.5. And here is reason pointing us to memory usage behavior: Report Viewer 2010 and .NET 4.5 uses another way to manage memory (named more advanced and more secure). However this ‘another’ way gets us mentioned questions from customers and really we can do nothing from NAV platform side – system works as it is designed to work.

    But things are not so bad. In .NET memory is managed very smart and not used memory is released by function named ‘garbage collector’. This function periodically review memory blocks and release not used. And actually it works: if we monitor memory during report previewing and after it close we see that in preview and going per pages memory usage increase, after preview close memory usage is still the same, but after 5-10 min used memory decrease to initial numbers. For example in my tests started RTC using 98.5 MB, after few previews and scrolls and etc. usage increases to 215 MB and doesn’t decrease if I close preview. But after few minutes garbage collector returns usage to 100.4 MB.
    We can force (in NAV platform) garbage collector to work faster and memory release will be faster, but this will increase processor usage and in many cases it is worse than memory usage.

    Few trick could help users do not meet memory problems:

    1. When we open report preview we see report in “funny” interactive mode. This is preview mode where we can change report view in some way described in report code. For example in report ‘Customer – Top 10 List’ sorting can be changed. But exactly this mode is memory monster. If we click ‘Print layout’ button in menu we come to ‘page view’ where we can change nothing in report and see exactly what will be printed. This mode doesn’t use memory so much, so we can use this view easier. Few additional points here: a) all report initially open in interactive mode so users need manually change mode; b) Mode is not available if report is not allowed to preview like Sales Invoice or Order Confirmation.
    2. Report run SAVEASPDF works better if we call it directly without request form. However then users need to do more actions to open report. But maybe this can be reasonable in some cases.
    3. And finally if there are requirements to run big reports with many pages (100 and more) then better is to run them on server side, just because server is 64 bits and usually has more available RAM. This can be done by creating codeunit which runs report SAVEASPDF. Then add codeunit to job queue. Job queue executes codeunit and create pdf file.


    New Information since Update Rollup 5:




    These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.


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


  • Microsoft Dynamics NAV Team Blog

    NAV 2009 (all versions) 2 part delegation configuration enabling access to Network File Share over 3-tier configuration


    In the RoleTailored client, operations such as RENAME and COPY fail if the destination for the file operation is not on the computer running Microsoft Dynamics NAV Server. One solution is to configure Microsoft Dynamics NAV Server to delegate on behalf of the RoleTailored client as described in this topic. In this case, you may also need to configure Microsoft Dynamics NAV Server to delegate to the cifs service on the destination computer. To avoid this complication entirely, define file operations so that the destination is always on the computer running Microsoft Dynamics NAV Server. You can then use a shared folder on the computer running Microsoft Dynamics NAV Server and share it with all users who require access to the files.

    If you have deployed Dynamics NAV 2009 R2 in a 3-tier configuration then you can follow steps below.


    In order to work with UNC link/Network share you must follow 2 stages of delegation the Middle Tier to the machine where the share is and choose the CIFS (Common Internet File System (CIFS) File Access Protocol or CIFS) from the list of services available, as per the images below on the three-tier environment:

    STAGE 1

    You need to delegate from the Middle Tier Service Account to the CIFS service running on the machine where the file share is located.

    In the image above, the service account is called navservice under which the middle tier is running. The delegation has been setup for Service Type cifs on the machine where the file share is located; in this case the machine is called NAV-CLIENT.

    (please ignore the fact that constraint delegation is missing. Image used to show CIFS)

     STAGE 2 

    Set up Constraint delegation on the MACHINE ACCOUNT (machine name of NAV Server) of the NAV Server machine to the CIFS Service of the machine where the file share is located. It is the same process you followed earlier to add CIFS delegation for the Service Account but we are doing this now from NAV machine account to
    Network Share destination machine account.


    • Once this change is has been made then please purge the ticket on the NAV Server machine using the Windows 2008 R2 command KLIST PURGE
    • Purge the ticket on the File Share machine if possible (Windows 2008 R2 same command as above or if it is a Windows 7 machine then you will need kerbtray.exe from this link)

    It is paramount that you reboot the NAV Server and File Share Server after this change!


    Best regards

    Zeeshan Mehdi

    The Microsoft Dynamics NAV Support team

Page 1 of 1 (9 items)