Microsoft Dynamics NAV

Team Blog

  • Microsoft Dynamics NAV Team Blog

    Coffee Break 16 – Using Windows PowerShell to Mark and Compare

    • 0 Comments

    This time we will take a fingerprint of a specific situation, and then use Diff to compare in order to see if the situation has changed over time or compared to a reference machine.

    Coffee Break – Fingerprints and Diff-Checks

    Sometimes you want to compare the current situation against a reference to see if the current situation is OK, or to check if something was changed. In this post we will create a reference (a fingerprint), and then use Diff to compare the current situation against this reference. The reference could be running processes, files, permissions, or more or less anything else. 

    Customer story:

    The system admin wants to check that all or all the right client files are in the client folder. So they create a fingerprint of what files should be there. This makes it possible to check if something or somebody modified client files.

    A different scenario is where the fingerprint is a platform update, and the Diff-check is about verifying which clients must have their client files updated.

    Take a fingerprint of a folder content

    See what’s in a folder:

    Get-ChildItem 'C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client’

    Save this folder content as a reference fingerprint:

    Get-ChildItem 'C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client' | Export-Clixml C:\Temp\ReferenceClient.xml

    Then keep this file ReferenceClient.xml, or copy it to a client machine, and whenever you need to know if something was changed:

    diff -ReferenceObject (Import-Clixml C:\Temp\ReferenceClient.xml) -DifferenceObject (Get-ChildItem 'C:\CUs\Build41779_Upd9\RoleTailoredClient\program files\Microsoft Dynamics NAV\80\RoleTailored Client') -Property LastWriteTime, Name

     

    CliXML is a format specific to PowerShell and a very simple way to pipe any output into a structured document. Structured making it better suited to compare.

     

    Other ways to use Diff

    You can compare services, compare processes, and compare Dynamics NAV permissions.

    Compare Services

    Let’s say we want to be able to check that certain services exist and are running. Check services:

    Get-Service

    Save this situation as a reference fingerprint:

    Get-Service | Export-Clixml -path C:\Temp\ReferenceServices.xml

     

    Then at a later time or on a different machine run a compare against this reference. Compare Status and Name:

    diff -ReferenceObject (Import-Clixml C:\temp\ReferenceServices.xml) -DifferenceObject (Get-Service) -Property Status,Name

     

    If for example a Dynamics NAV Server service was stopped, then this could be the result:

    Status Name                                     SideIndicator

     ------ ----                                     -------------

    Stopped MicrosoftDynamicsNavServer$DynamicsNAV80 =>                  

    Running MicrosoftDynamicsNavServer$DynamicsNAV80 <=

     

    Notice that the cmdlet will show each difference two times. The SideIndicator arrow points to the left if something was only on the left hand side (reference). If it points to the right then it was only on the right hand side.

    Compare processes:

    Get-Process | Export-Clixml -Path C:\temp\ReferenceProcess.xml

    diff -ReferenceObject (Import-Clixml C:\Temp\ReferenceProcess.xml) -DifferenceObject (Get-Process) -Property Name

    Compare Dynamics NAV permissions:

    Import-Module 'C:\Program Files\Microsoft Dynamics NAV\80\Service\Microsoft.Dynamics.Nav.Management.dll'

    Get-NAVServerPermission dynamicsnav80 -PermissionSetId CASHFLOW | Export-Clixml -path c:\temp\ReferencePermissions.xml

     

    diff -ReferenceObject (Import-Clixml C:\Temp\ReferencePermissions.xml) -DifferenceObject (Get-NAVServerPermission Dynamicsnav80 -permissionsetid CASHFLOW) -Property objectname

     

    Jasminka Thunes, Escalation Engineer Dynamics NAV EMEA

    Lars Lohndorf-Larsen, Escalation Engineer Dynamics NAV EMEA

    Bas Graaf, Senior Software Engineer Dynamics NAV

     

  • Microsoft Dynamics NAV Team Blog

    Client Add-in can fail with communication error (HTTP 413) in the Microsoft Dynamics NAV 2015 Web Client

    • 0 Comments

    Based on a very interesting development request about a drag-and-drop Client Add-In targeted for both Windows and Web clients for Dynamics NAV, we have been able to identify a communication error with Microsoft Dynamics NAV 2015 when users select and upload multiple files using a client add-in in the Dynamics NAV Web client.

    You might have heard about this through MVP blogs such as http://vjeko.com/blog/drag-and-drop-file-upload-for-microsoft-dynamics-nav-2013-r2.

    The issue is related to the fact that callback service requests has been limited to the WCF default message size (48 Kb). This turns out to be a problem for all partners who develop custom Client Add-Ins that send a discrete amount of data. 

    How to resolve this issue with Microsoft Dynamics NAV 2015:

    1. Update MaxReceivedMessageSize on WCF binding to a suitable value as described in an earlier blog post
      This value is taken from system.web/httpRuntime maxRequestLength (the default value should be 4 Mb).

    2. Download and deploy – at the very least the platform files – CU 10 for Microsoft Dynamics NAV 2015 (Build No. 42222) or a later CU in order to let the platform files update the WCF message size as indicated in bullet point #1.

    Please note that this feature was enhanced in Microsoft Dynamics NAV 2015 while earlier versions still stick with the WCF default message size and limitation.

     

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

     

    Duilio Tacconi                                      Microsoft Dynamics Italy         

    Microsoft Customer Service and Support (CSS) EMEA

    Special thanks to Lukasz Zoglowek from Microsoft Dynamics NAV Development Team and Kris Jordaens from sde.be 

  • Microsoft Dynamics NAV Team Blog

    Windows 10 and Dynamics NAV

    • 5 Comments

    We’ve been validating compatibility between Windows 10 and Dynamics NAV for many months now. Windows 10 became generally available in July, and some of you are eager to start deploying Dynamics NAV on Windows 10. 

    Dynamics NAV 2016 will be Windows 10 compatible on release. Look forward to that announcement!

    We expect to resolve any outstanding compatibility issues for Dynamics NAV 2013, Dynamics NAV 2013 R2, Dynamics NAV 2015 in the cumulative updates that we will ship in October.

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 29 for Microsoft Dynamics NAV 2013 has been released

    • 0 Comments

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

    The cumulative update is intended mainly for solutions that are experiencing the problems described in the Knowledge Base article linked to below. However, you are advised to always keep your solution updated with the latest cumulative update. If you are in doubt about whether this cumulative update addresses your specific problem, or if you want to confirm whether any special compatibility, installation, or download issues are associated with this cumulative update, support professionals in Customer Support Services are ready to help you. For more information, see http://support.microsoft.com/contactus/.

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

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

    Where to find Cumulative Update 29

    You can download the cumulative update from KB 3086433 - Cumulative Update 29 for Microsoft Dynamics NAV 2013 (Build 42219).

    Warning

    Before you install a cumulative update in a production environment, take the following precautions:

    1. Test the cumulative update in a non-production environment.
    2. Make a backup of the system or computer where the cumulative update is to be installed.

    Additional Information

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

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

    CustomerSource:

    PartnerSource:

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 10 for Microsoft Dynamics NAV 2015 has been released

    • 8 Comments

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

    The cumulative update is intended mainly for solutions that are experiencing the problems described in the Knowledge Base article linked to below. However, you are advised to always keep your solution updated with the latest cumulative update. If you are in doubt about whether this cumulative update addresses your specific problem, or if you want to confirm whether any special compatibility, installation, or download issues are associated with this cumulative update, support professionals in Customer Support Services are ready to help you. For more information, see http://support.microsoft.com/contactus/

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

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

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

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

    Where to find Cumulative Update 10

    You can download the cumulative update from KB 3086434 – Cumulative Update 10 for Microsoft Dynamics NAV 2015 (Build 42222). 

    Warning

    Before you install a cumulative update in a production environment, take the following precautions:

    1. Test the cumulative update in a non-production environment.
    2. Make a backup of the system or computer where the cumulative update is to be installed.

    Additional Information

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

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

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

  • Microsoft Dynamics NAV Team Blog

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

    • 1 Comments

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

    The cumulative update is intended mainly for solutions that are experiencing the problems described in the Knowledge Base article linked to below. However, you are advised to always keep your solution updated with the latest cumulative update. If you are in doubt about whether this cumulative update addresses your specific problem, or if you want to confirm whether any special compatibility, installation, or download issues are associated with this cumulative update, support professionals in Customer Support Services are ready to help you. For more information, see http://support.microsoft.com/contactus/.

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

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

    Where to find Cumulative Update 22

    You can download the cumulative update from KB 3084775 – Cumulative Update 22 for Microsoft Dynamics NAV 2013 R2 (Build 42221). 

    Warning

    Before you install a cumulative update in a production environment, take the following precautions:

    1. Test the cumulative update in a non-production environment.
    2. Make a backup of the system or computer where the cumulative update is to be installed.

    Additional Information

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

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

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

    CustomerSource:

    PartnerSource

  • Microsoft Dynamics NAV Team Blog

    Using the Microsoft Dynamics NAV 2015 Web Client without Internet Access

    • 1 Comments

    As you know, the Microsoft Dynamics NAV 2015 Web client is a website that you deploy and which your users can access from any browser. But in some businesses, users do not have Internet access, but they still want to be able to access Dynamics NAV from a browser. So how can you configure the Dynamics NAV Web client to not require Internet access? Well, you will have to change the configuration in Internet Information Services (IIS) Manager. Here are the steps for how to do this.

    1. Download the following two files:
    2. Open IIS Manager, locate the Microsoft Dynamics NAV 2015 Web client instance that you want to modify, expand it, right-click the Resources folder, and then choose Explore.
    3. Copy your downloaded, local versions of jquery-1.9.1.min.js and jquery-ui.min.js to the Resources folder.
    4. In Windows Explorer, navigate to the WebClient folder, and then open the default.master file in Notepad.
    5. Locate the following line:
      <Web:NoScriptControl runat="server" NoScriptTargetPage="DisabledJavaScript.aspx"/>

      After this line, add the following two lines:
        <script src="Resources\jquery-1.9.1.min.js" type="text/javascript"> </script>
        <script src="Resources\jquery-ui.min.js" type="text/javascript"> </script>

      The following snippet illustrates the result:

      <body class="v4master" scroll="no" id="formBody">
        <Web:NoScriptControl runat="server" NoScriptTargetPage="DisabledJavaScript.aspx"/>
        <script src="Resources\jquery-1.9.1.min.js" type="text/javascript"> </script>
        <script src="Resources\jquery-ui.min.js" type="text/javascript"> </script>

        <form id="aspnetForm" runat="server">
          <asp:ScriptManager runat="server" EnablePartialRendering="false"/>
          <asp:ContentPlaceHolder ID="BodyPlaceHolder" runat="server" ClientIDMode="Static"></asp:ContentPlaceHolder>
          <asp:ContentPlaceHolder ID="PHM" runat="server" ClientIDMode="Static"></asp:ContentPlaceHolder>
        </form>
    6. In the Dynamics NAV Windows client, open the "Control Add-ins" page.
    7. Select Microsoft.Dynamics.Nav.Client.BusinessChart, and then choose Export.
    8. Save the zip file locally and unzip the files.
    9. Open the manifest.xml file and find the ScriptUrl tag :
      <ScriptUrl>https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js</ScriptUrl>
      Change this line to the following:
      <ScriptUrl>Resources/jquery-1.9.1.min.js</ScriptUrl>
    10. Zip the folder again and import it back in the Control Add-ins page.
    11. In IIS Manager, restart the Dynamics NAV Web Client website.

    Please note that after these changes, this Dynamics NAV Web client instance will no longer be able to access the latest versions of the two query scripts.

     

    Gedas Busniauskas 

    Microsoft Dynamics NAV Support Engineer

  • Microsoft Dynamics NAV Team Blog

    Application Design Pattern: Report Selection

    • 0 Comments

    From the PRS workshop at NAVTechDays 2014, this pattern was written by 2 work groups:

    • Group 1: Dale Gauci & Kimberly Congleton
    • Group 2: Jens Winberg, Tim Grant, Alen Tot

    Thanks to Tim Grant for merging the two patterns, correct, send for review, and finalizing them!

    Meet the Pattern

    It should be possible to change which document report object should be used when printing. This configuration can be stored in one place (Report Selection) and available at configuration time. In this situation, the code for printing records can remain the same.

    The purpose of this pattern is to describe the process to implement a reports selection by retrieving the specific Document Header, determining which type of document is related to it in the Report Selection page, and call the report which needs to be printed by passing the specific document header. This specifies the reports that you can print when you work with the various documents for sales and purchases, such as orders, quotes, invoices, and credit memos.

    Know the Pattern

    In Dynamics NAV, you canpreselect which report will be printed when you print from various types of purchase and sales headers. For example, on an order, the Order Confirmation report is automatically printed.

    The Report Selection table contains the specification of which report will be printed in different situations. The Report Selection table also contains the report ID and report name for the report that will be printed when the user works with a given document type. 

    The user can, of course, choose to have Dynamics NAV print a different report than the preselected one. You can also add reports to the Report Selection table to have the program print more than one report per document type.

    This pattern should be used when the user needs to print a new type of document which can have different report layouts, or when the user needs to print several different reports in sequence. This can also be used during a new post and print routine, a test report for journal posting or for re-printing a posted document. Using this pattern will minimize code by allowing a flexible means of specifying different reports to print, instead of hard-coding a report id when printing a document.

    Use the Pattern

    The Report Selection Pattern involves the Report Selection table as the central configuration element also with the Report Selection page.  The table is used in 4 generic functional workflows:

    1) Test Print un-posted

    If the Report Selection is related to a Test Report relating to a document:

    • The document’s page object including printing actions
    • Test Report-Print Codeunit 228

    2) Print un-posted. If the Report Selection is related to an existing document (un-posted):

    • The document’s page object (document / list) including the printing actions
    • The Document-Print Codeunit 229 is used atomically to use the document type in the generic Sales Header table before the report selection is found.

    3) Print while posting. If the document is printed at the point of posting then:

    • The document’s Post + Print Codeunit (82 or 92), with the related GetReport andPrintReport functions.

    4) Print after posting. If the Report Selection is related to an existing document (posted):

    • The specific document related posted header table is used along with a typical function: PrintRecords within the respective table.

    Example

    Sales Document (Invoice)

    Pre-conditions

    • The document header/lines table is present and there is a report which has a parent DataItem linked to this document.
    • A document and list page is present and related to the document.
    • A post-and-print codeunit exists for the document.

    Continue reading on the community.dynamics.com NAV Patterns wiki site...

  • Microsoft Dynamics NAV Team Blog

    What to do when you cannot access a download?

    • 14 Comments

    This month's Cumulative Updates were made available for download this week. Some of you have experienced problems downloading the files, which causes understandable confusion and frustration. The problems can be caused by a number of different issues, including but not limited to server-side issues. The team that runs the download server is in process of verifying that the problems reported by some of you are not caused by issues on their side. So far, the number of successful downloads is higher than most months, but the number of download requests is also higher than normal, which may cause extra stress on the servers.

    If you experience download issues, support professionals in Customer Support Services are ready to help you. Use the familiar support channels in PartnerSource. For example, call your local Microsoft office: https://mbs.microsoft.com/partnersource/northamerica/support/support-news/Support_Telephone, or submit a new technical support  request: https://mbs2.microsoft.com/Support/newstart.aspx. Both pages require PartnerSource access. 

    Alternatively, see https://support.microsoft.com/en-us/contactus. This page is country-/region specific, so change the configuration at the bottom of the page.

    This blog post was updated on 13. July 2015. 

  • Microsoft Dynamics NAV Team Blog

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

    • 11 Comments

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

    The cumulative update is intended mainly for solutions that are experiencing the problems described in the Knowledge Base article linked to below. However, you are advised to always keep your solution updated with the latest cumulative update. If you are in doubt about whether this cumulative update addresses your specific problem, or if you want to confirm whether any special compatibility, installation, or download issues are associated with this cumulative update, support professionals in Customer Support Services are ready to help you. For more information, see http://support.microsoft.com/contactus/.

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

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

    Where to find Cumulative Update 21

    You can download the cumulative update from KB 3075724 – Cumulative Update 21 for Microsoft Dynamics NAV 2013 R2 (Build 41768). 

    Warning

    Before you install a cumulative update in a production environment, take the following precautions:

    1. Test the cumulative update in a non-production environment.
    2. Make a backup of the system or computer where the cumulative update is to be installed.

    Additional Information

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

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

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

    CustomerSource:

    PartnerSource

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 28 for Microsoft Dynamics NAV 2013 has been released

    • 3 Comments

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

    The cumulative update is intended mainly for solutions that are experiencing the problems described in the Knowledge Base article linked to below. However, you are advised to always keep your solution updated with the latest cumulative update. If you are in doubt about whether this cumulative update addresses your specific problem, or if you want to confirm whether any special compatibility, installation, or download issues are associated with this cumulative update, support professionals in Customer Support Services are ready to help you. For more information, see http://support.microsoft.com/contactus/.

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

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

    Where to find Cumulative Update 28

    You can download the cumulative update from KB 3075723 - Cumulative Update 28 for Microsoft Dynamics NAV 2013 (Build 41767).

    Warning

    Before you install a cumulative update in a production environment, take the following precautions:

    1. Test the cumulative update in a non-production environment.
    2. Make a backup of the system or computer where the cumulative update is to be installed.

    Additional Information

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

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

    CustomerSource:

    PartnerSource:

  • Microsoft Dynamics NAV Team Blog

    NAV Design Pattern: Using C/AL Query Objects to Detect Duplicates

    • 0 Comments

    This pattern uses queries to create an efficient way to detect duplicate entries in a table. This is, for example, useful when trying to find out which customers or contacts have the same names, so we can merge them later.

    Description

    Duplicate detection has several requirements in Microsoft Dynamics NAV. One method to eliminate duplication is by defining the relevant field as the primary key. However, this method is not always practical either due to the size of the field or due to business requirements that dictate how duplicates are detected but not necessarily how they are eliminated. An example of this method is to detect contacts with the same name and take action to merge them if they are.

    Before Dynamics NAV 2013, the only possibility was to iterate through the table in a loop and then create a sub-loop where another instance of the same table is filtered to check for duplicates. For example, to check for duplicate names in the Customer table, the code would look like this:

    PROCEDURE HasDuplicateCustomers@26() : Boolean;

        VAR

          Customer@1000 : Record 18;

          Customer2@1001 : Record 18;

        BEGIN

          IF Customer.FINDSET THEN

            REPEAT

              Customer2.SETRANGE(Name,Customer.Name);

              IF Customer2.COUNT > 1 THEN

                EXIT(TRUE);

            UNTIL Customer.NEXT = 0;

          EXIT(FALSE);

        END;


    This code would involve setting filters on the Customer table as many times as there are records in the table. This is an expensive operation.

     Starting with Dynamics NAV 2013, we can use queries to create a more efficient implementation of the same logic. 

    Usage

    The solution involves that you create a query to return duplicates, and then invoke it from a method that would test the value of the query to identify if duplicates were found.

    Step 1 – Creating the Query

    • The query must be created with the table we want to search in as the dataitem.
    • The field we want to search for must be created as a grouped field.
    • Create a totaling field on the count, and add a filter for Count > 1. This ensures that only records with more than one instance of the field that we selected in the previous step are included in the query result.

    Continuing with our Customer Name example, here is how the query would look:

    ELEMENTS

      {

        { 1   ;    ;DataItem;                    ;

                   DataItemTable=Table18 }

        { 2   ;1   ;Column  ;                    ;

                   DataSource=Name }

        { 3   ;1   ;Column  ;                    ;

                   ColumnFilter=Count_=FILTER(>1);

                   MethodType=Totals;

                   Method=Count }

      }

    Step 2 – Invoking the Query to Check for Duplicates

    Now that the query is created, all we need to do is to invoke the query and check if any records are returned, which would mean that there are duplicates.

    Here is an alternate implementation of the HasDuplicateCustomers method using the query that we created:

    PROCEDURE HasDuplicateCustomersWithQuery@27() : Boolean;

        VAR

          CustomerDuplicate@1000 : Query 70000;

        BEGIN

          CustomerDuplicate.OPEN;

          EXIT(CustomerDuplicate.READ);

        END;

     

    Read more on NAV Design Patterns wiki...

    by Abshishek Ghosh and Bogdan Sturzoiu at Microsoft Development Center Copenhagen

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 9 for Microsoft Dynamics NAV 2015 has been released

    • 23 Comments

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

    The cumulative update is intended mainly for solutions that are experiencing the problems described in the Knowledge Base article linked to below. However, you are advised to always keep your solution updated with the latest cumulative update. If you are in doubt about whether this cumulative update addresses your specific problem, or if you want to confirm whether any special compatibility, installation, or download issues are associated with this cumulative update, support professionals in Customer Support Services are ready to help you. For more information, see http://support.microsoft.com/contactus/

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

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

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

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

    Where to find Cumulative Update 9

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

    Warning

    Before you install a cumulative update in a production environment, take the following precautions:

    1. Test the cumulative update in a non-production environment.
    2. Make a backup of the system or computer where the cumulative update is to be installed.

    Additional Information

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

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

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

  • Microsoft Dynamics NAV Team Blog

    Coffee Break - Monitoring and Troubleshooting Services Part 2

    • 2 Comments

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

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

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

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

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

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

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

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

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

    Example:

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

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

    $LogFolder = 'c:\Logs'

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

     

    #provide server config file name

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

     

    #provide full path and name of the config file 

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

     

    #Upload config as xml document

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

     

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

    Get-Member -InputObject $blobxml

     

    To check the childnodes of the document, use

    $blobxml.ChildNodes

     

    To create a node, use

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

     

    To append the node:

    $Node.AppendChild($elem)

     

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

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

    Note that the example adds the following tracing configuration:

    MessageLogging,  switchValue="Warning, ActivityTracing"

    Tracing, switchValue="Verbose,ActivityTracing"

     

    wmiProviderEnabled= "true"

     

    logEntireMessage="true"

    logMalformedMessages="true"

    logMessagesAtServiceLevel="true"

    logMessagesAtTransportLevel="true"

    maxMessagesToLog="100000"

    maxSizeOfMessageToLog="10000000"

     

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

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

     

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

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

     

    MessageLogging,  switchValue=" "

    Tracing, switchValue=" "

     

    wmiProviderEnabled= "false"

     

    logEntireMessage="false"

    logMalformedMessages="false"

    logMessagesAtServiceLevel="false"

    logMessagesAtTransportLevel="false"

    maxMessagesToLog="0"

    maxSizeOfMessageToLog="0"

     

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

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

     

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

    Happy troubleshooting!

     

    Jasminka Thunes, Escalation Engineer Dynamics NAV EMEA

    Lars Lohndorf-Larsen, Escalation Engineer Dynamics NAV EMEA

    Bas Graaf, Senior Software Engineer Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Coffee Break - Monitoring and troubleshooting NAV Services

    • 3 Comments

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

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

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

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

    • Get-EventLog
    • Get-WinEvent

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

    Get the Application Log

    Get-WinEvent -LogName Application -MaxEvents 100

    or read it from a saved log:

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

    or from a remote machine:

    Get-WinEvent -MaxEvents 100 -ComputerName MySvr2012

    or from a list of remote machines:

    $Servers="localhost","MySvr2012"

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


    Look for providers

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

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

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

    Get-WinEvent -ProviderName "MicrosoftDynamicsNavServer`$DynamicsNAV80"

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

     Use FitlerHashTable for filters

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

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

    The syntax is:
    @{Key=Value;Key=Value;etc}

    Example: Look for Application Log entries from Dynamics NAV:

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

     

    Useful filters:

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

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

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

    $EndDate=Get-Date

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

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

    And Remotely

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

    More details about remoting PowerShell with Dynamics NAV here.

    Find specific events

    Find a specific event in the Application Log:

    $pattern = "NAS Startup Parameter"#or

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

    $pattern = "Deadlock"#or

    $pattern = "System.InvalidCastException"#or

    $pattern = "Server instance: DynamicsNAV80"#or

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

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

    Printing details

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

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

    or keep it in table format but wrap each line:

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

    or control the output via a variable:

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

    $Events[1].Message

     

     

     

    Jasminka Thunes, Escalation Engineer Dynamics NAV EMEA

    Lars Lohndorf-Larsen, Escalation Engineer Dynamics NAV EMEA

    Bas Graaf, Senior Software Engineer Dynamics NAV

     

     

Page 1 of 52 (770 items) 12345»