Microsoft Dynamics NAV

Team Blog

  • Microsoft Dynamics NAV Team Blog

    Upgrade Toolkit for Upgrading Data from Microsoft Dynamics NAV 2009 R2 and Microsoft Dynamics NAV 2009 SP1 to Microsoft Dynamics NAV 2013 R2

    • 53 Comments

    The components needed to upgrade data directly from Microsoft Dynamics NAV 2009 R2 to Microsoft Dynamics NAV 2013 R2 are now available for download.

    Download the upgrade toolkit from PartnerSource or from CustomerSource

    In order to use the toolkit to upgrade data from Microsoft Dynamics 2009 R2 or Microsoft Dynamics NAV 2009 SP1, you will also need the Microsoft Dynamics NAV 2013 development environment and Microsoft Dynamics NAV 2013 R2.

    At the Directions EMEA conference in Vienna and the Directions US conference in Nashville, we said that we have a team that is focusing on the Microsoft Dynamics NAV upgrade story. Going through the big transformation from the classic stack to the new product architecture in Microsoft Dynamics NAV 2009 was not easy and is challenging many customers and partners. So for our team, it is essential that the final outcome of our work is that each upgrade is easier, requires significantly less effort, and that it does not disrupt the daily business for our customers.

    In Microsoft Dynamics NAV 2013 R2, we introduced support for converting a Microsoft Dynamics NAV 2013 database so that you can run an application that was created in Microsoft Dynamics NAV 2013 on the Microsoft Dynamics NAV 2013 R2 platform, also known as a technical upgrade.

    Note: We strongly recommend that you upgrade the application objects as well so that your solution includes the important application fixes and new functionality that is introduced in Microsoft Dynamics NAV 2013 R2.

    Secondly, you can fully automate the data upgrade process using the Windows PowerShell scripts that we included in the Microsoft Dynamics NAV 2013 R2 product media. Historically, this process has been known for its tediousness and high risk of human error when multiple operations had to be executed consecutively in all companies of the database that you were upgrading. The scripts automate this work so that you can test and execute your data upgrades more reliably.

    Now with this delivery, we introduce an upgrade toolkit for upgrading the data from Microsoft Dynamics NAV 2009 R2 to Microsoft Dynamics NAV 2013 R2. This significantly simplifies the upgrade process for those of you coming from Microsoft Dynamics NAV 2009 R2 – or Microsoft Dynamics NAV 2009 SP1.

    Included in the new upgrade toolkit are all known data upgrade-related application hotfixes that we are aware of, and we also addressed several platform issues that affected the upgrade scenario.

    Note: You must download the latest Microsoft Dynamics NAV platform hotfixes before you start using the upgrade toolkit. The required hotfixes for Microsoft Dynamics NAV 2013 are available in the latest hotfix rollup, which you can download from PartnerSource or CustomerSource. For Microsoft Dynamics NAV 2013 R2, you can download the required hotfixes from PartnerSource or CustomerSource.

    When you download the new upgrade toolkit from the link above, you can use it to simply your upgrade process. Here are the main steps in upgrading from Microsoft Dynamics NAV 2009 R2 (or Microsoft Dynamics NAV 2009 SP1) by using the new upgrade toolkit.

    Note

    Before you start, make sure that you use the latest platform binaries for all versions of Microsoft Dynamics NAV in this process. For more information, see the following pages for the latest updates to the versions of Microsoft Dynamics NAV:

    Microsoft Dynamics NAV 2009 R2: Overview of Released Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2.

    Microsoft Dynamics NAV 2013: Released Cumulative Updates for Microsoft Dynamics NAV 2013.

    Microsoft Dynamics NAV 2013 R2: Released Cumulative Updates for Microsoft Dynamics NAV 2013 R2.

    To upgrade data from a Microsoft Dynamics NAV 2009 R2 or Microsoft Dynamics NAV 2009 SP1 database

    1. In the Microsoft Dynamics NAV  2009 R2 or Microsoft Dynamics NAV  2009 SP1 development environment (Classic client):
      1. Make sure that all table objects have compiled successfully. During compilation, Microsoft Dynamics NAV generates or regenerates the BLOB content in the Object Metadata table that is used in the later steps.  In the Tools menu, choose Build Server Application Objects.
        Note: You must also do this if you upgrade from Microsoft Dynamics NAV 2013 to Microsoft Dynamics NAV 2013 R2 . All tables must be compiled Microsoft Dynamics in NAV 2013 before you start upgrading to Microsoft Dynamics NAV 2013 R2.
      2. Create a copy or a backup of your old Microsoft Dynamics NAV 2009 R2 database, and open it in the Microsoft Dynamics NAV 2009 R2 development environment.
      3. Add your partner license to the database.
        You can do this by selecting the Save License in Database field in the Alter Database window. If the field was not already selected, a dialog box opens so you can specify the location of your partner license.
        If the field was already selected, upload the partner license from the License Information window.
      4. Open the Object Designer, and then import Upgrade601701.1.fob. If the .fob file contains objects with conflicting versions that are already in the database, the Import Worksheet window opens. Choose Replace All.
      5. For each company in the database, open the company, and make the relevant changes to data. For more information, see Task 3: Data/Object Changes Prior to Step 1 in the MSDN Library.
    2. Then, from the Object Designer, run form 104001, Upgrade - Old Version. Choose the Transfer Data button. Repeat this action for each company in the database. 
      Note
      We strongly recommend that you back up the database using SQL Server management tools after this step. 
    3. When you have transferred all data for all companies, in the Upgrade - Old Version window, choose the Delete Objects button.
      This action deletes all objects in the database that are not tables, but also obsolete tables that belong to functionality that is not available in Microsoft Dynamics NAV 2013 R2.
    4. Uninstall Microsoft Dynamics NAV 2009 R2, and then install Microsoft Dynamics NAV 2013.
      Note
      You do not have to install the full Microsoft Dynamics NAV 2013 product to perform the following database conversion. Instead, you can create a folder with the following files from the Microsoft Dynamics NAV 2013 product media:
      • Finsql.exe
      • Fin.stx
      • Fin.etx
      • CRONUS.FLF
      • Ndbcs.dll

      You can then use the Finsql.exe file to perform the conversion.  

    5. Change the compatibility level of your database. For SQL Server 2008 and SQL Server 2008 R2, verify that the compatibility level of the database is set to 100. For SQL Server 2012, set the compatibility level to 110.
    6. In the Microsoft Dynamics NAV 2013 development environment, open the Microsoft Dynamics NAV 2009 R2 database and agree to convert the database. The database has now been technically upgraded to Microsoft Dynamics NAV 2013.

      Note 
      During this step, Microsoft Dynamics NAV converts all text and code fields to Unicode format by changing their SQL Server data type. This conversion requires more disk space than usual, since both the database and the log file will grow in size considerably. It can also be a lengthy process.

      If your Microsoft Dynamics NAV 2009 R2 database is using SQL Server Collation, within the same step the collation will be changed to a suitable Windows collation. This is because Microsoft Dynamics NAV 2013 and higher versions only support Windows Collation. If you converted your database using the RTM version of Microsoft Dynamics NAV 2013, you may be experiencing collation-related issues after this conversion. Therefore it is strongly recommended to use the latest available version of Microsoft Dynamics NAV 2013 development environment to perform this step.

      Note
      We strongly recommend that you take a full SQL Server backup at this stage when the database conversion has completed.

    7. Uninstall Microsoft Dynamics NAV 2013, and then install Microsoft Dynamics NAV 2013 R2.
    8. In the Microsoft Dynamics NAV 2013 R2 development environment:
      1. Open the Microsoft Dynamics NAV 2013 database and agree to convert the database.
      2. Compile the system tables. You can find the tables by setting a filter for table ID 2000000004..2000000130.
        In the following step, you will be connecting a Microsoft Dynamics NAV Server instance to the database. 
    9. Make sure that the service account that the Microsoft Dynamics NAV Server instance uses has the db_owner role for the database. 

      Note 
      If you are upgrading a large database, such as a database size of more than 20-25 GB, make sure that you increase the timeout value in the Microsoft Dynamics NAV Server configuration file. In the CustomSettings.config file, the value is defined in the SQL Command Timeout node. The default value is 10 minutes, which is sufficient in the normal day-to-day work. However, during an upgrade that can take several hours depending on the size of the tables, you must increase the timeout period.

    10. Connect the Microsoft Dynamics NAV Server instance to the database, and then start the service instance.
    11. In the Microsoft Dynamics NAV 2013 R2 development environment:
      1. On the Tools menu, open Options, and then, make sure that the Prevent data loss from table changes field is set to Yes.You must also make sure that the Server Name, Server Instance, and Server Port fields are filled in.
        This ensures that the Microsoft Dynamics NAV Server instance that is connected to the database will verify that no operation will cause loss of data in the development environment.
      2. Import all customized objects in .fob format into the upgraded database. If the .fob file contains objects with conflicting versions that are already in the database, the Import Worksheet window opens. Choose Replace All.
      3. Make sure all objects are compiled.

        Important
        It is very important that at least all table objects have successfully compiled before you proceed.

      4. Import Upgrade Step 2 objects from the Upgrade601701.2.fob file.If the .fob file contains objects with conflicting versions that are already in the database, the Import Worksheet window opens. Choose Replace All.
    12. Perform the database schema synchronization by running the Sync-NAVTenant Windows PowerShell cmdlet in the Microsoft Dynamics NAV 2013 R2 Administration Shell (run as administrator).

      Note
      When you upgrade from one version to another, this typically involves numerous changes in the structure of the Microsoft Dynamics NAV tables (the object metadata). Database synchronization ensures that these changes in the metadata are applied to the corresponding tables in SQL Server. For example, it changes columns dimensions and data types, drops and create indices, drops and creates indexed views (V-SIFT), creates new tables, columns, and so on.

      When the number of changes is high, such as comparing Microsoft Dynamics NAV 2009 R2 to Microsoft Dynamics NAV 2013 R2, this synchronization can become a lengthy and resource consuming task.

      Database synchronization is triggered upon any request to Microsoft Dynamics NAV Server, such as when you start a client or run a windows Powershell cmdlet. Microsoft Dynamics NAV Server checks if metadata has changed since the last synchronization by comparing the content of the Object Metadata and Object Metadata Snapshot system tables. If a change is found, the synchronization procedure is initiated.  

      When the synchronization process has started, it is essential that you wait for it to complete or rollback (in case of an error or time-out). If you’re running a client, do not confirm or click anything client side. If you’re running the Sync-NAVTenant cmdlet, wait for it to complete and return control to the Windows PowerShell command prompt.

      Do NOT stop the Microsoft Dynamics NAV Server service at this point since there are high chances that the database synchronization transaction is still running.

      1. Run Microsoft Dynamics NAV 2013 R2 Administration Shell as Administrator. This opens a PowerShell prompt where the Microsoft Dynamics NAV cmdlets are available.

      2. Run the synchronization command against your upgrade database as follows: 

        Sync-NAVTenant –ServerInstance <MyNAVServerInstance> 

      3. Wait until the cmdlet returns control to the Windows PowerShell window.

    13. Open the Microsoft Dynamics NAV 2013 R2 Windows client to verify that you are connected to the Microsoft Dynamics NAV Server instance that is connected to the database being upgraded. 
      Next, you will run Upgrade Step 2 in each company in the upgraded database. You can get a list of all existing companies in the database by running the Get-NAVCompany cmdlet and passing as an argument the Microsoft Dynamics NAV Server instance which is connected to the upgraded database. 
      You will run objects directly from the development environment, so you must specify the company that the objects must run in in the Options window.
    14. In the Microsoft Dynamics NAV 2013 R2 development environment:
      1. On the Tools menu, open Options, and then, in the Company field, specify the name of the first company.
      2. In the Object Designer, find page 104002 Upgrade - New Version, and then choose Run.
      3. In the Upgrade - New Version window, choose Test Database Connection to make sure that the C/AL code that is triggered by the actions on the page has access to the database.
        If your database is on a named SQL Server instance, you must specify the full name in the SQL Server Name field.  
      4. Choose Transfer Data.
        If the process is successful, and you don't have to revisit the upgrade logs, you can clean the content of the Upgrade Time Log  table. 
      5. On the Navigate tab, choose Time Log, and then, in the Upgrade Time Log page, delete all records.
      6. Close the Upgrade - New Version window, and then close the Microsoft Dynamics NAV Windows client.
    15. Repeat step 14 for each remaining company in the database.
    16. When you have successfully transferred data in the last company, you must upgrade data that is common to all companies in the database, such as permissions, permission sets, web services, profiles and control add-ins.
    17. Upgrade data common to all companies such as permissions, permission sets, web services, profiles and control add-ins.
      If the customer has changed the Read/Write/Modify/Delete/Execute settings for any of the standard permissions, or customized default permission sets in any way, you must merge these changes into the default permissions sets and permissions that are included in Microsoft Dynamics NAV 2013 R2. You can use XMLport 104001 Import/Export Roles and XMLport 104002 Import/Export Permissions to export the new default roles and permissions from the CRONUS International Ltd. demonstration database in Microsoft Dynamics NAV 2013 R2. You can add control add-ins in the Control Add-ins window in the Microsoft Dynamics NAV Windows client. For more information, see How to: Register a Windows Client Control Add-in. For example, the following client control add-ins are available from the Microsoft Dynamics NAV 2013 R2 product media:
      • Microsoft.Dynamics.Nav.Client.BusinessChart
      • Microsoft.Dynamics.Nav.Client.PageReady
      • Microsoft.Dynamics.Nav.Client.PingPong
      • Microsoft.Dynamics.Nav.Client.VideoPlayer
    18. Delete the upgrade toolkit objects.
      1. In the Upgrade - New Version window, choose Mark/Delete Upgrade Toolkit.
        This deletes all upgrade toolkit objects, except tables
      2. In the Microsoft Dynamics NAV development environment, delete the upgrade tables by setting a field filter for objects where the Version List contains Upgrade Toolkit Table - marked for deletion.

    The database has now been through a data upgrade to Microsoft Dynamics NAV 2013 R2.

    Best regards,

    The Microsoft Dynamics NAV Service Experience team

    -----Blog post updated in May 2014-----

     

  • Microsoft Dynamics NAV Team Blog

    Using Web Services to Access Microsoft Dynamics NAV 5.0

    • 49 Comments

    Introduction

    Dynamics NAV 2009 contains a new subsystem for dealing with Web Services. This feature has been well received by partners and customers alike. Partners have expressed interest in having web services available for earlier versions of Dynamics NAV. This feedback resulted in a technology talk at Directions2007 in Florida, where the topic was what could be done to day. The conclusion of the talk was that everything we where intending to deliver was already possible today, yes some code is needed but strictly from function/feature perspective all of it is possible, and it is not even all that ugly. Dynamics NAV 2009 will provide out-of-the-box programmatic web service access to the application and will therefore remove the need for this additional technology plumbing described here.

    I have to say that the response to my talk has been tremendous. After the response to my talk on Web Services in NAV 5.0 and previous versions I decided to write this blog post and make the source files available.

    This post is about how to bridge the gap between the need for web services now and the current platform, it will help you understand how you can provide Web Services directly from Dynamics NAV today, in a “simple” and flexible way, already today.

    To work with the samples in this post you will need: Visual Studio 2005, Dynamics NAV 5.0 and .Net 3.0 installed on your system. This sample should work on Dynamics NAV 4.0 to but has not been tested on that version.

    Architecture

    The system we will build contains 4 different components/moving parts: Web Service Listener, Event Dispatcher, Codeunit Eventhandler and XMLPort for stream handling.

    image

    Web Service Consumer

    Any client that understands how to communicate with Web Services; like InfoPath, Visual Studio, SharePoint or any custom application written by you.

    Port

    Is the physical communication port that the WCF listens to.

    WCF Web Service

    Defines the data contracts and service contracts for the Web Service, it also implements the concrete service and opens for listening in the WCF subsystem, it then delegates the requests to the COM Event Dispatcher component.

    COM Event Dispatcher

    This component provides the hookups for Dynamics NAV, both to activate the service and to register event sinks. It defines 2 IDispatch interfaces the IServiceEvents and the IWebServiceListner, as well as the concrete implementation of the IWebServiceListner in the WebServiceListner class that provides the actual code for hooking up the WCF Web Service to Dynamics NAV.

    .NET

    We are using the CLR runtime for writing our Web Service component and our COM plugin. Some of this blog entry is about interop between Dynamics NAV and .NET through COM.

    Codeunit Event Handler

    Is responsible for starting up the WCF Web Service through the COM interface, it then registered for events coming from the WCF Web Service Component. The events routed to XMLPort for processing.

    XMLPorts for datastreams

    It deals with the actual business logic and data coming from or going to the Web Service.

    Implementation

    The implementation is in 2 programming languages: C# and C/AL.

    Please take a look at the provided code sample, for the rest of the information contained in the posting. It can be found here: http://code.msdn.microsoft.com/nav/Release/ProjectReleases.aspx?ReleaseId=896

    I have included comments in the code that should explain what is going on, if you feel something is missing, first look at the documentation for the WCF or post a comment to this post and I will try to answer it.

    Deployment of Sample

    To deploy the sample you will first have to download it, unpack it.

    Then open it up with Visual Studio and compile.

    Then import the codeunit.txt and xmlport.txt into your NAV installation and compile those objects, starting with the XMLPort

    To run the service simply open the Object Designer in NAV, find the Codeunit that you just imported and press run.

    There is no dependency on IIS or other external components. No further deployment steps should be needed.

    In the Visual studio solution is a ConsoleTestApp project. After you have followed the steps above you can run that project, it will test if your install was successful, as well as provide sample on how to use the web service.

    Special considerations

    In this sample I’m using XMLPort to handle the XML stream that is provided.

    You can take many different approaches to this, and still reuse large please of the code provided in the sample.

    To use the XMLPort as handler you will have to set the encoding property to UTF-8. This is due to a null termination bug in stream handler in NAV.

    image

    image

    With this approach you can already today, incorporate web services in your projects in straightforward way.

    The appropriate usage is whenever you need to give external application access to Dynamics NAV data or business process.

    For any questions or comments please feel free to ask them in the comment section of this blog post.  I will answer questions to best of my ability on this post in the comments section as well.

    One last thing:  This is a sample code.  It has not been tested, you should thoroughly test this code before usage.

    Best regards,
    Kris Rafnsson

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 1 for Microsoft Dynamics NAV 2015 has been released

    • 46 Comments

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

     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
    •   RU – Russia
    •   SE - Sweden
    •   UK - United Kingdom

    Where to find Cumulative Update 1

    You can download the cumulative update from KB 3013215  – Cumulative Update 1 for Microsoft Dynamics NAV 2015 (Build 38457). The cumulative update was temporarily unavailable for download, but it is now available again. The new set of download packages contain the DVD image and the Application folder only. The files in the new download packages have the exact same build number as the files in the original download. The new download will give you the same options for patching both new and current installations of Microsoft Dynamics NAV 2015. You can either install the new image or you can unpack the image and copy/paste files from the DVD folder structure.

    Upgrade Toolkit for Upgrading Data from Microsoft Dynamics NAV 2009 R2 or SP1 to Microsoft Dynamics NAV 2015

    The cumulative update includes an upgrade toolkit for upgrading a Microsoft Dynamics NAV 2009 R2 or Microsoft Dynamics NAV 2009 SP1 database to Microsoft Dynamics NAV 2015. The upgrade toolkit includes several application objects in FOB files that simplify the upgrade process for those of you coming from Microsoft Dynamics NAV 2009 R2 or Microsoft Dynamics NAV 2009 SP1. For more information, see the attached whitepaper.

     

    ---- This blog post was updated on 13. November 2014 ---- 

     

  • Microsoft Dynamics NAV Team Blog

    Important Information: In a live database with active users connected, changing an object multiple times or compiling all objects can cause data loss in NAV 2013 R2

    • 38 Comments

    You may experience data loss in Microsoft Dynamics NAV 2013 R2 in the following situations, separately or in combination:

    • Changing an application object more than once, for example by two different developers, in the same database connected to the same Microsoft Dynamics NAV Server instance while users are working in the system.
    • Compiling all application objects, and thereby potentially changing objects more than once, in a database that is connected to a Microsoft Dynamics NAV Server instance that users are accessing.

    To avoid the problem, we advise that you work according to the following best practices:

    • Application developers must be working on their own database and connect to their own Microsoft Dynamics NAV Server instance. When you deploy changes to the live production database, make sure that no users are working in the system.
    • You must compile objects only when no users are working in the system, including users connecting through NAS. 

    With update rollup 5 for Microsoft Dynamics NAV 2013 R2 - KB 2937999, this issue has been fixed and you do not have to take the precautions described above. However, we still advise that you separate development from production databases.

    Please note that implementing update rollup 5 will require a database conversion.

     

     

  • Microsoft Dynamics NAV Team Blog

    The New Table Synchronization Paradigm in Microsoft Dynamics NAV 2013 R2

    • 34 Comments

    Microsoft Dynamics NAV 2013 R2 was dispatched with a brand new feature that introduces big challenges to all of the Microsoft Dynamics NAV channel: Multitenancy. In simple words, multitenancy allows partners to deal with hosting scenarios on-premises and in cloud services in an easier and more flexible way than in the past.

    Before Microsoft Dynamics NAV 2013 R2, partners and customers could only use a single-tenant scenario (here also called Legacy mode).

    Below a short explanation how table synchronization used to work in earlier versions.

    Microsoft Dynamics NAV 2009 / Microsoft Dynamics NAV 2013

    1. At object import/compile, C/SIDE checks the Object Metadata version in working memory and compares it to the version in Object Metadata table to decide if and what kind of change is made.
    2. Schema changes are DIRECTLY APPLIED to the SQL Server database by C/SIDE if there is no breaking schema change, otherwise an error will be thrown by C/SIDE depending on SQL Server error catch.
    3. Object Change Listener is checking for changes in metadata, then updating Microsoft Dynamics NAV Server Cache with data from Object Metadata table if the change was detected.

    A synchronization failure would typically be reported with an error like “The Object Metadata does not exist. Identification and values … “ when running the Microsoft Dynamics NAV Windows client.

    The multitenancy feature has also changed the design how Microsoft Dynamics NAV developers has to deal with object changes, overall related to table objects. Multitenancy implies that the table structure definition has to be stored in the application database and this needs to be applied on one or more separate storage databases called Tenants. From a development perspective, this means that any modification that are made to a table object in C/SIDE are NOT DIRECTLY applied to the SQL Server structure but there is a need of performing a secondary action to apply and made persistent these modification at SQL Server side: this process is called Synchronization. Microsoft Dynamics NAV 2013 R2, then, comes with a time decoupling between table metadata creation (C/SIDE) and data structure changes (SQL Server).

    In order to simplify the current design, the Microsoft Dynamics NAV development team decided to handle single- and multitenant scenarios in the same way (roughly speaking a single-tenant / Legacy mode is handled as a multitenant scenario with a single tenant database constantly mounted against an application database).

    Below a short explanation how this is working in practice.

    Microsoft Dynamics NAV 2013 R2

    SCENARIO 1:

    • Single-tenancy / Legacy mode
    • “Prevent data loss from table changes” = Yes (default):

     

    1. At object import/compile, C/SIDE checks the Object Metadata version in working memory and compares it to the version in Object Metadata table to decide if and what kind of change is made. (Same as in Microsoft Dynamics NAV 2009 and Microsoft Dynamics NAV 2013)
    2. C/SIDE then CALLS THE Microsoft Dynamics NAV Server to check for breaking schema changes in SQL Server structure.
      If C/SIDE is unable to call the Microsoft Dynamics NAV Server or if a breaking schema change is attempted (action that cannot performed due to the current SQL Server structure such as deleting a field containing data): a C/SIDE error is reported accordingly and changes to Object Metadata table will not be committed.
      If it is evaluated as not attempting a breaking schema change in SQL Server then metadata from C/SIDE working memory is saved and committed to Object Metadata table.
      PLEASE NOTE: at this stage NO CHANGES ARE MADE TO THE SQL SERVER DATA STRUCTURE.
    3. When prompting for SYNCHRONIZATION, Microsoft Dynamics NAV Server then compares Object Metadata table with Object Metadata Snapshot table content. Any difference in the value for the “Hash” field is a flag to Microsoft Dynamics NAV Server that a change exists and should be subsequently applied physically SQL Server side as structural changes.

    Prompting for Synchronization happens when

    -         Performing ANY Microsoft Dynamics NAV client action.

    For example, if a user opens a Microsoft Dynamics  NAV Windows client, then Microsoft Dynamics NAV Server is starting applying the relevant structure changes to SQL Server, and the Microsoft Dynamics NAV Windows client is not shown until all the changes are done on SQL Server side.

    OR

    -         Running the Sync-NAVTenant Windows PowerShell cmdlet.

    SCENARIO 2 (DEPRECATED):

    • Single-tenancy / Legacy mode
    • “Prevent data loss from table changes” = No (Manually opted, not persistent)

    IMPORTANT NOTICE:

    Setting the “Prevent data loss from table changes” C/SIDE switch to “No” has been intended to be used as last resource in a pure multitenancy scenario and in Test or Staging environments when partners does not have any business data database mounted against the application database. All other usages that deviate from this statement might lead to unpredictable results and even undesired data loss scenarios in upgrades or, even worse, production environments.

    Never change for any reason this parameter to “No” when developing against a single-tenant / Legacy mode database.

    1. At object import/compile: C/SIDE checks the Object Metadata version in working memory and compares it to the version in Object Metadata table to decide if and what kind of change is made. (Same as in Microsoft Dynamics NAV 2009 and Microsoft Dynamics NAV 2013)
    2. C/SIDE DOES NOT CHECK FOR ANY BREAKING SCHEMA CHANGES IN SQL SERVER but simply FORCES COMMIT of metadata from C/SIDE cache TO the Object Metadata table.
    3. When prompting for SYNCHRONIZATION, Microsoft Dynamics NAV Server then compares Object Metadata table with Object Metadata Snapshot table content. Any difference in the value for the “Hash” field is a flag to Microsoft Dynamics NAV Server that a change exists and should be subsequently applied physically SQL Server side as structural changes.

    Since no validation is made against SQL Server (“Prevent data loss from table changes” was set to “No”) there might be chances that this will result in:

    • Data Loss
      There are few specific cases where data is dropped in this scenario:
      • The primary key is detected as being no longer unique
      • Data per Company is changed from Yes to No and more than one company contains data
      • One or more fields are deleted
      • One or more field data type is/are changed
    • Missing Synchronization
      Activities cannot be completed since SQL Server prevents these actions that would break the data structure and therefore no Microsoft Dynamics NAV Windows client or Web client can connect to the database. The partner or customer has to resolve these missing synchronization issues before moving forward or fall back to a backup where these issues does no longer exists

    SCENARIO 3:

    • Multitenancy
    • “Prevent data loss from table changes” = Yes (default):

    Same as Scenario 1 for point 1. and point 2.

    When prompting for SYNCHRONIZATION, changes will be triggered and applied to the SQL Server data structure.

    Prompting for synchronization in a pure multitenant deployment happens when

    -         Performing ANY Microsoft Dynamics NAV client action

    OR

    -         Running the Sync-NAVTenant Windows PowerShell cmdlet

    OR

    -         Mounting a tenant database

     

    Based on the scenario depicted above, there might be risks of data loss and/or missing synchronization issues if handling C/SIDE development (namely dealing with Table objects) in a way that deviate by the prospected paradigm.

    Data loss issues:

    These might arise typically in one of the following scenarios:

    • Direct removal of rows from the Object Metadata table in SQL Server
    • Stretched / Borderline scenarios that implement platform files with a Build No. lower than 36281 KB 2934571 as described in this blog post.

     

    Synchronization issues:

    These might arise typically in one of the following scenarios:

    • The Microsoft Dynamics NAV Server service account has insufficient permissions
      The service account must be added to “db owner” SQL Server role for the Microsoft Dynamics NAV tenant Database.
    • Stretched / Borderline scenarios that implement platform files with a Build No. lower than 36281 KB 2934571 as described in this blog post.
      With a lower build number, you might get into one of the following scenarios:
      • When several developers commit changes at the same time in the same database / tenant while synchronization is running, this might lead to metadata corruption. (Object Metadata table now is locked for committing  changes).
      • Doing actions like FOB Import > Replace > SaveAs  and then Import again the saved FOB was causing a metadata corruption.
    • SQL Connection Timeout meanwhile performing an operation, such as when SQL Server schema changes require drop and build of indexes on large tables.
      To resolve this issue it is necessary to increment the following parameter in the Microsoft Dynamics NAV Server CustomSettings.config file
       <add key="SqlCommandTimeout" value="10:00:00" />

    Development Environment best practice

    thinking about potential data loss and synchronization issues is a brand new big challenge in the development environment, and so some consideration and following best practice might be advisable. These applies to developing solutions for both single- and multitenant deployments.

    1. Do not use Build No. lower than than 36310 KB 2934572
      As a partner, you take this as the "RTM Build No." starting point for NAV 2013 R2 and deploy this platform hotfix in the future projects while you also convert existing installations.
      NOTE: As per common best practice, we recommend that you download / request / test and deploy the latest platform hotfix for Microsoft Dynamics NAV 2013 R2. This will contain correction for minor issues not directly or just slightly related to synchronization scenarios.
    2. Never-ever change “Prevent data loss from table changes” to “No”.
      This have been noticed as one of the major source of potential data loss and missing synchronization for NAV 2013 R2 databases.
    3. Make sure that the Microsoft Dynamics NAV Server service account has been granted the “db owner” role in SQL Server.
    4. Increment the SQL Server Command Timeout parameter in the Microsoft Dynamics NAV Server configuration file that you use in development to a very high value (such as 10:00:00)
    5. For large Microsoft Dynamics NAV objects OR a high number of table modifications, do NOT use a Microsoft Dynamics NAV client action to prompt for synchronization but it is warmly preferable to use the Sync-NAVTenant Windows PowerShell cmdlet. (This is a typical scenario related to upgrades).
    6. For big batch of FOB files that are making a high number of table modifications, be sure to have this tested on a safe staging environment and import, where possible, the Table Objects in smaller chunks and synchronize them after importing every single chunk of Microsoft Dynamics NAV objects.
    7. For important changes in several table structures, such as when upgrading from previous version, it would be good to run a SQL Server Profiler trace after prompting for synchronization to check what is running on the SQL Server side and keep the synchronization monitored until it ends.

    Recommended Events:

    • SP:StmtCompleted
    • SQL:StmtCompleted

    Recommended Column Filters:

    • DatabaseName   Like <DatabaseName>
    • TextData       Not Like  SELECT %

    Bottom line. Worth mentioning that if a Microsoft Dynamics NAV Client hang / disconnect happens due to a missing synchronization issue or there were a synchronization transaction running behind the transaction rollback SQL Server side will take a higher amount of time in comparison with the same committed transaction, depending on the type of changes, resources available, etc.

    Just in case you fall back in this situation, it is warmly advisable to do not stop nor restart Microsoft Dynamics NAV Server and check through a SQL Server Profiler trace and/or via SQL Server Management Studio if the transaction has successfully rollback.

    Another blog post will follow this one, related to synchronization challenges and best practice while upgrading to Microsoft Dynamics NAV 2013 R2 from previous versions.

     

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

     

    Gerard Conroy - Microsoft Dynamics UK

    Abdelrahman Erlebach - Microsoft Dynamics Germany

    Duilio Tacconi - Microsoft Dynamics Italy

    Jasminka Thunes - Microsoft Dynamics Norway                   

    Microsoft Customer Service and Support (CSS) EMEA

     

    A special thanks to Jorge Alberto Torres & Jesper Falkebo from the Microsoft Dynamics NAV development team

  • Microsoft Dynamics NAV Team Blog

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

    • 34 Comments

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

     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 17

    You can download the cumulative update from KB 3039826  – Cumulative Update 17 for Microsoft Dynamics NAV 2013 R2 (Build 40076). 

    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

    Merging Application Objects using Windows PowerShell in Microsoft Dynamics NAV 2015

    • 29 Comments

    Upgrading a Microsoft Dynamics NAV solution is time consuming. You have to identify which changes you have to make, you have to upgrade the application objects and the application code, and you might have to move the existing data around so that it fits the new database schema. In Microsoft Dynamics NAV 2013 R2 Cumulative Update 9, we introduced a new set of Windows PowerShell cmdlets that can help you through the code upgrade. In Microsoft Dynamics NAV 2015, the functionality and sample scripts have been further improved.

    You can use the new cmdlets to modify application object source files in the Microsoft Dynamics NAV 2015 Development Shell, or by importing the Microsoft.Dynamics.NAV.Model.Tools.psd1 module into the Windows PowerShell Integrated Scripting Environment (ISE). The new application merge utilities install when you choose the Developer option in Microsoft Dynamics NAV 2015 Setup, or if you add the development environment to another installation option.

    The application merge utilities include the following Windows PowerShell cmdlets:

    Name

    Description

    Merge-NAVApplicationObject

    Compares the changes that have been made between two sets of Microsoft Dynamics NAV application objects, and applies the difference to a third set of application objects. The result of the merge is a number of text files with the merged application objects. Any conflicts that the cmdlet cannot merge are identified in conflict files.

    Compare-NAVApplicationObject

    Compares text files that contain Microsoft Dynamics NAV application objects, and then calculates the delta between the two versions. The result of the comparison is a number of text files with the calculated delta.

    Update-NAVApplicationObject

    Applies a set of deltas to the specified application objects. The files that describe the delta are generated by the Compare-NAVApplicationObject cmdlet.

    Join-NAVApplicationObjectFile

    Combines multiple application object files into one text file

    Split-NAVApplicationObjectFile

    Splits a text file that contains two or more application objects into separate text files for each application object.

    Get-NAVApplicationObjectProperty

    Gets Microsoft Dynamics NAV application object properties from the specified application object text files.

    Set-NAVApplicationObjectProperty

    Sets Microsoft Dynamics NAV application object properties in the specified application object text files.

    Export-NAVApplicationObjectLanguage

    Exports captions from the specified text files with Microsoft Dynamics NAV application objects. The captions are exported to text files.

    Import-NAVApplicationObjectLanguage

    Imports strings in the specified language into text files that contain Microsoft Dynamics NAV application objects.

    Join-NAVApplicationObjectLanguageFile

    Combines multiple text files with captions for Microsoft Dynamics NAV application objects into one text file.

    Remove-NAVApplicationObjectLanguage

    Deletes captions in the specified language from Microsoft Dynamics NAV application objects.

    Split-NAVApplicationObjectLanguageFile

    Splits a text file that contains multilanguage captions for two or more application objects into separate text files for each application object.

    Test-NAVApplicationObjectLanguageFile

    Tests captions in Microsoft Dynamics NAV application objects to test to validate if they have translated strings for the specified languages.

     Getting started

    You can read more about the cmdlets and how to use them in the MSDN Library, but you can also type Get-Help "NAV" in the Windows PowerShell ISE or the Microsoft Dynamics NAV Development Shell.

    If you don’t want to use the Microsoft Dynamics NAV Development Shell, use the Windows PowerShell ISE. But before you can access the cmdlets, you must import the Microsoft.Dynamics.Nav.Model.Tools.psd1 module. Here is an example of the command you can type:

    Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -force

    Get-Help "NAV"

    Now you can see the Help for the cmdlets and take a closer look at the examples for how to use them.

    Now you can see the Help for the cmdlets and take a closer look at the examples for how to use them. You can also see detailed Help for each cmdlet by typing the following command:

    Get-Help cmdletname -detailed

    And you can concentrate on the examples by typing the following command:

    Get-Help cmdletname -examples

     For all of the new cmdlets, the starting point is 3 versions of application objects that you want to merge. The following table describes the three versions of the Microsoft Dynamics NAV application that you want to compare and merge.

    Version

    Description

    Original

    The baseline of the application merge. For example, the Microsoft release of Microsoft Dynamics NAV 2013 R2.

    Modified

    The updated version of the original. For example, this can be your add-on.

    In many cases, the modified application is the version that contains fewer changes to the original than the version that is the target of the merge. This is because you want to apply fewer changes to a large application rather than applying a large change to a small application.

    Target

    The version of the application that you want to apply the difference between the original and the modified application to. For example, this can be the new major release from Microsoft of Microsoft Dynamics NAV 2015 that you want to apply your modified solution to.

    Each of these versions can be any version that you want to do a three-way merge between. ORIGINAL can be your add-on, MODIFIED can be a customization of your add-on, and TARGET can be a new release of Microsoft Dynamics NAV from Microsoft. But for the purposes of this blog post, we'll keep the definitions as described in the table above.

    As input to the cmdlets, you can provide a text file, a list of text files, or a folder with text files. So you need to export the relevant application objects as text files. Optionally, you can use the development environment command ExportObjects. You can export each application object to a separate text file, or you can export all objects to a single text file. Optionally, you can use the Join-NAVApplicationObjectFile and Split-NAVApplicationObjectFile cmdlets to structure the text files in the way that works better for you. Also, depending on your scenario, you can work with a subset of your application, such as all codeunits, objects within an ID range, or a specific group of objects. Use the tools to get the text files that you need, and take a look at the sample scripts for inspiration.

    The Windows PowerShell sample scripts are available on the product media. Start by opening the HowTo-Start-Import-NAV-Module.ps1 script in the Windows PowerShell IDE, navigate the command prompt to the folder where you placed the samples, and then run the script. Then open one of the other scripts, such as HowTo-Merge-1-General.ps1, and follow the guidance in the script.

    We suggest that you open each of the sample scripts in the Windows PowerShell IDE and read through them to get acquainted with the new cmdlets. Then, set up a small test environment of your own where you can safely use the cmdlets on your own application objects to upgrade your solution to Microsoft Dynamics NAV 2015.

     

  • Microsoft Dynamics NAV Team Blog

    Update Rollups and Project Considerations for Upgrade, Maintenance and New Implementations

    • 29 Comments

    More and more partners are beginning to work with the update rollups. They find a lot of value in applying the latest application and platform fixes up front, instead of waiting for a customer to report those. Update rollups also simplify the way fixes are discovered and surfaced.

    So with this blog post, we want to provide a more detailed picture of the update rollups, their purpose, and their usage scenarios so that you are aware of the rollup release process and components, and so that more of you start using them. We would also like to provide our look at how to adopt and use the update rollups within various stages of the implementation project lifecycle.

    What is an update rollup?

    Update rollups are released monthly for Microsoft Dynamics NAV 2013 and Microsoft Dynamics NAV 2013 R2: 

    Released update rollups for Microsoft Dynamics NAV 2013 R2

    Released update rollups for Microsoft Dynamics NAV 2013

    An update rollup is a set of files that includes all hotfixes (application and platform) and regulatory features that have been released for the versions of Microsoft Dynamics NAV that are listed above. 

    They are cumulative, meaning that they include hotfixes and regulatory features that were released in the earlier update rollups for the specific product version.

    Each rollup contains the following:

    • Accumulated application change log (TXT format) compared to the originally release of the specific product version (the RTM release).
    • Application change log (TXT format) compared to the previous rollup - the “delta”.
    • Only the application objects that changed since the RTM version are included in the FOB and TXT files provided with the rollup.
    • Each application object is marked with rollup version number (version number + build number) to make it possible to see which objects have been changed in which rollup.
    • The latest version of all (not only the changed ones) platform components (executables and .dll assemblies). These components are also stamped with a version number and a build number.

    Application changes:

    Platform components:

    Hotfixes that are included in the update rollups do not always include translation. In that case, the translation for such changes are provided with the next RTM version of  Microsoft Dynamics NAV (major releases or minor release). Regulatory features included in the rollup are almost always translated; however, in rare cases the translation is provided with the following monthly update rollup.   

    Update rollups are currently released for 10 countries: Australia, Germany, Denmark, France, Italy, North America (Canada, US, Mexico), Netherlands, New Zealand, Sweden, United Kingdom.

    Local hotfixes for the following countries are currently not included in update rollups: Austria, Belgium, Switzerland, Spain, Finland, India, Iceland, Norway.

    Scenarios

    Maintenance. Applying rollups for the countries/regions where they are available.

    If you have a version of the running application for which you would like to apply the update rollup, you can follow this high level flow:

    • Find the latest rollup available for your application version here:
    • See the KB article for the UR to find the full list of application and platform changes as well as regulatory updates included in it. The list is divided by country/region. For instance, here are the KB articles for the latest available rollups:
    • Based on the urgency and relevance of the application and platform changes, current project stage, customer situation and other surrounding factors decide whether you want to apply the UR now, or wait for the next one. We strongly recommend that you always apply the latest UR to gradually reduce the amount of regressions, merging, issues and to be compliant with the latest regulatory requirements. 
    • If you are on the RTM version merge your application objects with all objects included with the latest rollup.
    • If you are on the URn version – filter out the objects which were changed since URn till the latest available UR and merge your application objects with those objects. You can use the Version List field to see in which rollup (build) they were changed. 

    Maintenance. Applying hotfixes for the countries where update rollups are not available.

    For these cases the process of applying the hotfixes and regulatory updates is the same as it was before the UR concept was introduced, namely the changes relevant to all countries/regions (W1 changes) should be applied one by one.

    However, URs can aid this process as well as you can obtain all W1 changes by downloading the latest W1 UR and merge them into your country version. You can find W1 URs by clicking at “Show additional information” and looking at their Fix Name which you can see when you download the UR:

    Platform components are country independent, therefore the platform updates can also be obtained from W1 UR and deployed for any country/region-specific version of Microsoft Dynamics NAV.

    Major releases, minor releases, and update rollups

    URs are different from the major and minor releases. Every major and minor release contains new application and platform features and functionality as well as hotfixes, while the URs only contain hotfixes and regulatory updates. So when a major release or minor release has been released, we create a new branch for the next release and continue to maintain both branches.

    Let’s dissect the process based on the Microsoft Dynamics NAV 2013 version as an example (see the illustration below).

    When Microsoft Dynamics NAV 2013 version was released, we created a new branch for Microsoft Dynamics NAV 2013 R2 development. As we’ve been building Microsoft Dynamics NAV 2013 R2 functionality, we kept fixing Microsoft Dynamics NAV 2013 and kept releasing URs for it.

    Relevant fixes from the Microsoft Dynamics NAV 2013 version were merged into the Microsoft Dynamics NAV 2013 R2 version in the course of its development. In many cases they had to be redesigned to fit the new code and new functionality of Microsoft Dynamics NAV 2013 R2.

    Therefore, when Microsoft Dynamics NAV 2013 R2 was released, not all fixes included in the latest available Microsoft Dynamics NAV 2013 UR were included in it. The process of finding and merging relevant fixes into the latest branch is a continuous process, and there will be a certain lead time until the fixes from the releases are synchronized between branches. So, for instance, the majority of the fixes which were available in Microsoft Dynamics NAV 2013 UR7 were included into Microsoft Dynamics NAV 2013 R2 UR1, and the process of merging of relevant fixes will go on.

    When considering upgrade or a new implementation of the new major release or minor release, we recommend that you always upgrade to (or start from) the latest available UR for it. If there is a particular hotfix which is available in the previous version of Microsoft Dynamics NAV, but it not yet available in the latest release, you can always request it to be merged there using the normal support process “How to create a new support case”.  It is also always possible to only update the platform components with the updated ones coming from a corresponding UR (technical upgrade), although the best practice would be to keep the application objects updated to the latest UR as well.

    Microsoft Dynamics NAV 2013 R2 hotfixes are also periodically merged into Microsoft Dynamics NAV 2013 and will be eventually available in the upcoming URs. Similarly, if there is a particular hotfix which is available in the current version of Microsoft Dynamics NAV, but it not yet available in the previous release, you can also request it to be merged there using the same support process “How to create a new support case”. 

    We will continue to release URs for the Microsoft Dynamics NAV 2013 release and future releases periodically, synchronizing relevant fixes between them over time.

    Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2 are maintained following the old process - you can request hotfixes on case by case basis, no update rollups available for those product versions. 

    The following timeline illustrates the process.

     

    Conclusion

    It is highly recommended to implement the update rollups. We look forward to hearing your feedback and suggestions to how this process could be made more convenient for you to assess and absorb the changes.

     

    Kind regards,

    Microsoft Dynamics NAV Team

     

    Updated on January 16, 2014: We removed two sentences that were misleading around the upgrade rollups and the Upgrade Toolkit. We apologize for the confusion.

  • Microsoft Dynamics NAV Team Blog

    Updated: How to log report usage

    • 28 Comments

    Updated: Now with links to both NAV 5.0 and NAV 2009 hotfixes

     /Claus Lundstrøm

    ******

    In several partners meetings I have heard this requests over and over again.

    Claus, when we are planning an upgrade of Classic reports to RDLC reports, we do not always know which reports are actually being used at the customer site. It would be great to be able to log which reports are used so we know exactly which reports we need to upgrade to RDLC.

    Well, if you download below hotfix you will now have the capability to log report usage at a customer site.

    Dynamics NAV 5.0: KB2575296

    Dynamics NAV 2009: KB2558650
    Find links to all NAV 2009 Platform Hotfixes here:
    CustomerSource: Overview of Released Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2
    PartnerSource: Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2

     

    In the following steps I have outlined which steps you need to do to get this log file. Remember above hotfix is required to perform the following steps.

    1. Create new table to be used for Log report usage:

    clip_image002

    OBJECT Table 50000 Report Log
    {
    OBJECT-PROPERTIES
    {
    Date=22-06-11;
    Time=14:19:58;
    Modified=Yes;
    Version List=CLAUSL;
    }
    PROPERTIES
    {
    }
    FIELDS
    {
    { 1 ; ;No. ;Integer ;AutoIncrement=Yes;
    MinValue=1 }
    { 2 ; ;User ID ;Code50 ;TableRelation="User Role"."Role ID";
    CaptionML=ENU=User ID }
    { 3 ; ;Report ID ;Integer ;CaptionML=ENU=Report ID }
    { 4 ; ;Report Name ;Text249 ;FieldClass=FlowField;
    CalcFormula=Lookup(AllObjWithCaption."Object Caption" WHERE (Object Type=CONST(Report),
    Object ID=FIELD(Report ID)));
    CaptionML=ENU=Report Name }
    { 5 ; ;Date Time ;DateTime }
    }
    KEYS
    {
    { ;No. ;Clustered=Yes }
    }
    FIELDGROUPS
    {
    }
    CODE
    {
    BEGIN
    END.
    }
    }

    2. Now with the table created for our Report Usage log please open Codeunit 1

    3. Open “C/AL Globals”

    4. Navigate to ”Functions”

    clip_image004

    5. Create new function with Name=”OnReportRun”

    clip_image006

    6. Open Properties and change ID to 120

    clip_image008

    7. Now open “Locals” and create parameter= ReportId with Type=Integer

    clip_image010

    8. Select Variables tab and create ReportLog

    clip_image012

    9. Now all we need is to write the code for this new trigger. Open C/AL Editor and navigate to the end.

    10. In OnReportRun write the following code:

    ReportLog."User ID" := USERID;

    ReportLog."Report ID" := ReportId;

    ReportLog."Date Time" := CURRENTDATETIME;

    ReportLog.INSERT;

    clip_image014

    11. Now Restart Classic Client

    12. Run a couple of reports

    13. And then at last run the Report Log table to see the result:

    clip_image016

    Yes I’m aware that this solution only works for Classic Reports, and yes I also would like a feature so it’s possible for you to log all objects being used at a customer site. For now we do not get this, but let’s see what the future brings.

    /Claus Lundstrøm

  • Microsoft Dynamics NAV Team Blog

    QR Codes for Microsoft Dynamics NAV

    • 28 Comments

    QR codes (abbreviated from Quick Response code) are appearing in many different places today, and they are found to be quick and efficient when it comes to working with mobile phones and other devices which can read them. QR Code is a multipurpose instrument and it can hold all sorts of different types of valuable information like your company’s or your salesperson’s contact details, sales invoice information, promotional codes, location information, checksums, amounts, web links etc., which you can read using a QR code reader to automate some of the routine manual processes, like typing in things manually. 

    The QR code is a two-dimensional data-matrix which can be decoded very fast. The format is clearly defined and published as an ISO standard.

    QR code

    As the Windows Phone 7.5 update, code name “Mango”, rolls out to customers, it makes it even more relevant to use the QR codes, as you can now use your Windows phone camera to scan QR codes by bringing them into camera view. Bing will recognize QR codes and will help you save and use the information encoded in it.

    In some countries, popularity of QR codes has grown so much, that their usage is now considered a national standard. Our team has recently released an update for the Mexican market, where we added QR codes to several major Microsoft Dynamics NAV documents. And we thought – why don’t we let everyone else enjoy this new cool feature?

    The update is available for NAV 5.0 SP1, NAV 2009 SP1 and NAV 2009 R2 versions of the product.

    URLs for Microsoft Dynamics NAV 2009 SP1 and R2:

    https://mbs.microsoft.com/customersource/downloads/taxupdates/MSDNAV2009SP1ElectronicInvoice_Mexico   

    URLs for Microsoft Dynamics NAV 5.0 SP1 :

    https://mbs.microsoft.com/customersource/downloads/taxupdates/MSDNAV5SP1ElectronicInvoice_Mexico

    However, the only part you need from it is the MXElectronicInvoice.msi file included in the package. Note that the .msi file is exactly the same for both versions of NAV.

    Here is what you have to do to get your data encoded into a QR code:

    1. Run the installer to deploy the dll we shipped for this update. Among other things, the dll includes QRCodeProvider  and IBarCodeProvider classes which we can use.

    2. Add a BLOB field which will be storing the QR Code image into the Sales Invoice Header table for example:

    3. Remember to set the SubType property to Bitmap if you would like to use the QR code on pages:

    4. You can now use the following code to generate a QR code image, which for demo purposes will be saved into a first found posted sales invoice (needless to say, you should be doing it on a test database ;) ) In this example we will encode a contact card with some predefined details.

    OBJECT Codeunit 50001 QR Code Mgt.
    {
      OBJECT-PROPERTIES
      {
        Date=;
        Time=;
        Modified=Yes;
        Version List=QR Code;
      }
      PROPERTIES
      {
        OnRun=VAR
                CompanyInfo@1170000004 : Record 2000000006;
                SalesInvoiceHeader@1170000003 : Record 112;
                TempBlob@1170000002 : Record 99008535;
                QRCodeInput@1170000000 : Text[1024];
                QRCodeFileName@1170000001 : Text[1024];
              BEGIN
                // Save a QR code image into a file in a temporary folder
                QRCodeInput := CreateQRCodeInput('John,Doe','+555 1231231','john@doe.zzz','www.johndoe.zzz');
                QRCodeFileName := GetQRCode(QRCodeInput);
                QRCodeFileName := MoveToMagicPath(QRCodeFileName); // To avoid confirmation dialogue on RTC

               // Load the image from file into the BLOB field
                CLEAR(TempBlob);
                ThreeTierMgt.BLOBImport(TempBlob,QRCodeFileName,FALSE);
                IF SalesInvoiceHeader.FINDFIRST THEN BEGIN
                  SalesInvoiceHeader."QR Code" := TempBlob.Blob;
                  SalesInvoiceHeader.MODIFY;
                END;

               // Erase the temporary file
                IF NOT ISSERVICETIER THEN
                  IF EXISTS(QRCodeFileName) THEN
                    ERASE(QRCodeFileName);

                MESSAGE('Done!');
              END;
      }
      CODE
      {
        VAR
          ThreeTierMgt@1170000001 : Codeunit 419;

        LOCAL PROCEDURE CreateQRCodeInput@1020046(Name@1020000 : Text[80];PhoneNo@1020002 : Text[80];EMail@1020003 : Text[80];URL@1170000000 : Text[80]) QRCodeInput : Text[1024];
        BEGIN
          QRCodeInput :=
            'MECARD:' +
            'N:' + Name + ';' +
            'TEL:' + PhoneNo + ';' +
            'EMAIL:' + EMail + ';' +
            'URL:' + URL + ';';
        END;

        LOCAL PROCEDURE GetQRCode@1020038(QRCodeInput@1020001 : Text[1024]) QRCodeFileName : Text[1024];
        VAR
          IBarCodeProvider@1020000 : Automation "{89F54BC4-E6C9-44BA-8574-86568625BFF8} 1.0:{9FE38730-1A3C-4B84-A8C2-AFAC6A90E641}:'Microsoft Dynamics Nav MX Services'.IBarCodeProvider";
        BEGIN
          GetBarCodeProvider(IBarCodeProvider);
          QRCodeFileName := IBarCodeProvider.GetBarCode(QRCodeInput);
        END;

        PROCEDURE GetBarCodeProvider@1020001(VAR IBarCodeProvider@1020000 : Automation "{89F54BC4-E6C9-44BA-8574-86568625BFF8} 1.0:{9FE38730-1A3C-4B84-A8C2-AFAC6A90E641}:'Microsoft Dynamics Nav MX Services'.IBarCodeProvider");
        VAR
          QRCodeProvider@1020002 : Automation "{89F54BC4-E6C9-44BA-8574-86568625BFF8} 1.0:{69FEA5E6-0A76-4555-B74B-F170956B0098}:'Microsoft Dynamics Nav MX Services'.QRCodeProvider";
        BEGIN
          IF ISCLEAR(QRCodeProvider) THEN
            CREATE(QRCodeProvider,TRUE,TRUE);
          IBarCodeProvider := QRCodeProvider;
        END;

        PROCEDURE MoveToMagicPath@1170000000(SourceFileName@1170000000 : Text[1024]) DestinationFileName : Text[1024];
        VAR
          FileSystemObject@1170000001 : Automation "{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} 1.0:{0D43FE01-F093-11CF-8940-00A0C9054228}:'Windows Script Host Object Model'.FileSystemObject";
        BEGIN
          DestinationFileName := ThreeTierMgt.ClientTempFileName('','');
          IF ISCLEAR(FileSystemObject) THEN
            CREATE(FileSystemObject,TRUE,TRUE);
          FileSystemObject.MoveFile(SourceFileName,DestinationFileName);
        END;

        BEGIN
        END.
      }
    }

    5. With the image saved in the BLOB field, it is now “business as usual” to add it to a report. You can see, for example, how company logo is added to the standard NAV document reports. NB. Don’t forget to run CALCFIELDS on the "QR Code" field before you display its content. :-)

    6. And finally – run the report to see the QR code which you or your customers can scan, for example, with your favorite  Windows 7.5 mobile phone:

     

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

     

    Best regards,

    Microsoft Dynamics NAV ERM Team

    Dmitry Chadayev, Program Manager

  • Microsoft Dynamics NAV Team Blog

    Importing and Exporting Data in Microsoft Dynamics NAV 2013 R2 CU 8

    • 28 Comments

    In earlier versions of Microsoft Dynamics NAV, you could move or copy all or part of the data in a database by using the Microsoft Dynamics NAV backup functionality. In Microsoft Dynamics NAV 2013 R2, the support for the .fbk files was removed, but with Cumulative Update 8 for Microsoft Dynamics NAV 2013 R2, we introduce Windows PowerShell cmdlets so you can export data from a Microsoft Dynamics NAV database and import it into another Microsoft Dynamics NAV database. You can also export and import data in the Microsoft Dynamics NAV Windows client.

    You can export and import a single company or all companies in a database, and you can export and import other types of data such as global data, application data, and application objects. As part of Cumulative Update 8, we include a whitepaper that provides examples of the types of data and how to export and import data using Windows PowerShell cmdlets as well as in the Microsoft Dynamics NAV Windows client.

    When you export data from a Microsoft Dynamics NAV database, the data is stored in a file with the extension .navdata, which is a new file format that is proprietary to Microsoft Dynamics NAV data. You cannot edit the .navdata files in other tools.

    The data that you export is not deleted from the original database. So that means that you can use the functionality to essentially take a copy of your customer’s live data, leave them to continue working, while you import the data into an offline database back at your office for further debugging or other investigation. You can also use the .navdata files to move data to a new database, such as moving a company to a new database when you want to deprecate a database, for example.

    Exporting and Importing Data in the Microsoft Dynamics NAV Windows Client

    To export or import data, in the Search box, enter Data File, and then choose the related link.

    To export data, you specify the type of data that you want to export, and when you choose the OK button, you specify where you want to save the file.

    To import data, you specify the .navdata file to import data from, but you can't import an application if the .navdata file contains an application. This is because you can't overwrite the application that is currently open in the Microsoft Dynamics NAV Windows client. So the window has one less type of data that you can choose to import:

    If you want to import an application into a Microsoft Dynamics NAV database, you must use the Import-NAVData Windows PowerShell cmdlet.

    Windows PowerShell Cmdlets

    The following table describes the Windows PowerShell cmdlets that are new in Microsoft Dynamics NAV 2013 R2 Cumulative Update 8.

    Name

    Description

    Export-NAVData

    Exports data from a Microsoft Dynamics NAV database. You can export company-specific data, and you can choose to include global data, application data, or application objects.

    Import-NAVData

    Imports data into a Microsoft Dynamics NAV database from a file. You can import all data in the file, or you can choose to include specific companies, global data, application data, or application objects.

    You can only import an application into an empty database.

    Get-NAVDataFile

    Gets information from a file that has been exported from a Microsoft Dynamics NAV database.

    The extracted information includes the types of data that the file contains and any company names.

    The cmdlets take different parameter sets depending on how you connect to the database that you want to export data from or import data into. You can access the database through the Microsoft Dynamics NAV Server instance, or you can access the database directly as described in the following table.

    Access

    Description

    Through the Microsoft Dynamics NAV Server instance.

    Use parameter sets that include –ServerInstance when the database that you want to access is mounted against a Microsoft Dynamics NAV Server instance.

    The user account for the Microsoft Dynamics NAV Server instance must have access to write to the location that is specified by the –FileName parameter.

    Through a direct connection to the database.

    Use parameter sets that include –DatabaseServer and –DatabaseName when the Microsoft Dynamics NAV Server instance is stopped or not available. For example, if you want to import an updated application into a database, you stop the service so that users cannot access the database.

    You must have access to write to the location that is specified by the –FileName parameter.

    The following table describes the Windows PowerShell cmdlets that are modified in Microsoft Dynamics NAV 2013 R2 Cumulative Update 8.

    Name

    Description

    Get-NAVCompany

    Gets a list of the Microsoft Dynamics NAV companies in the specified tenant database or exported Microsoft Dynamics NAV data file.

    The cmdlet has been updated to be able to get information from a Microsoft Dynamics NAV data file.

     

    However, the Help for the Export-NAVData and Import-NAVData Windows PowerShell cmdlets does not show the correct syntax when you run a command such as the following:.

    PS C:\WINDOWS\system32> Get-Help Export-NAVData

     

    Refer to the following syntax for the Export-NAVData cmdlet:

    1. Export-NAVData -DatabaseName <string> -FileName <string> [-DatabaseServer <string>] [-ApplicationDatabaseServer <string>] [-ApplicationDatabaseName <string>] [-Description <string>] [-IncludeApplication] [-IncludeApplicationData] [-IncludeGlobalData] [-CompanyName <string[]>] [-Force]  [<CommonParameters>]

    2. Export-NAVData [-ServerInstance] <string> [[-Tenant]< TenantId>] -FileName<string> [-Description <string>] [-IncludeApplication] [-IncludeApplicationData] [-IncludeGlobalData] [-CompanyName <string[]>] [-Force]  [<CommonParameters>]

    3. Export-NAVData [-ServerInstance] <string> [[-Tenant] <TenantId>] -FileName<string> -AllCompanies [-Description <string>] [-IncludeApplication] [-IncludeApplicationData] [-IncludeGlobalData] [-Force]  [<CommonParameters>]

    4. Export-NAVData -DatabaseName <string> -FileName <string> -AllCompanies [-DatabaseServer <string>] [-ApplicationDatabaseServer <string>] [-ApplicationDatabaseName <string>] [-Description <string>] [-IncludeApplication] [-IncludeApplicationData] [-IncludeGlobalData] [-Force]  [<CommonParameters>]

     

    Refer to the following syntax for the Import-NAVData cmdlet:

    1. Import-NAVData [-FileName] <string> -DatabaseName <string> [-DatabaseServer <string>] [-ApplicationDatabaseServer <string>] [-ApplicationDatabaseName <string>] [-IncludeApplication] [-IncludeApplicationData] [-IncludeGlobalData] [-CompanyName <string[]>] [-Force] [-WhatIf] [-Confirm]  [<CommonParameters>]

    2. Import-NAVData [-ServerInstance]< string> [[-Tenant] <TenantId>] [-FileName] <string> [-IncludeApplicationData] [-IncludeGlobalData] [-CompanyName <string[]>] [-Force] [-WhatIf] [-Confirm]  [<CommonParameters>]

    3. Import-NAVData [-ServerInstance]< string> [[-Tenant] <TenantId>] [-FileName] <string> -AllCompanies [-IncludeApplicationData] [-IncludeGlobalData] [-Force] [-WhatIf] [-Confirm]  [<CommonParameters>]

    4. Import-NAVData [-FileName] <string> -DatabaseName <string> -AllCompanies [-DatabaseServer <string>] [-ApplicationDatabaseServer <string>] [-ApplicationDatabaseName <string>] [-IncludeApplication] [-IncludeApplicationData] [-IncludeGlobalData] [-Force] [-WhatIf] [-Confirm]  [<CommonParameters>]

     

    You can find more information about this functionality, and the new or changed objects, in the following documents on the W1 version of the Microsoft Dynamics NAV 2013 R2 CU8 download media:

    • MicrosoftDynamicsNAV2013R2CU8_ExportImportDataUsingNavDataFiles.pptx
    • MicrosoftDynamicsNAV2013R2CU8_ImportExportData.pdf

    In subsequent cumulative updates, the documents will be available in the country-specific downloads as well.

  • Microsoft Dynamics NAV Team Blog

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

    • 27 Comments

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

    With update rollup 5, local hotfixes for additional countries have been added, and update rollups for Microsoft Dynamics NAV 2013 R2 now include hotfixes that apply to all countries and hotfixes specific to the following local versions:

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

     

    Where to find update rollup 5

    You can download update rollup 5 from KB 2937999 - Update Rollup 5 for Microsoft Dynamics NAV 2013 R2 (Build 36281). Note: Implementing this update rollup will require a database conversion.

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

    CustomerSource:

    PartnerSource

     

    More Information

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

  • Microsoft Dynamics NAV Team Blog

    Cumulative Update 9 for Microsoft Dynamics NAV 2015 has been released

    • 22 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

    C/SIDE Improvements in Dynamics NAV 2009 R2

    • 21 Comments

    Microsoft Dynamics NAV 2009 R2 has several new features as part of the C/SIDE development environment. After several years (and releases) of building a strong new platform, we are able to refocus our efforts onto making fantastic developer focused features for C/AL developers. You can expect this trend to continue with even more in NAV "7" and further but without further ado, I'd like to introduce you to some of your newest friends...

    1. CTRL+F12

    Also known as Go-To-Definition, I'm sure you'll become intimately familiar with the keyboard shortcut rather than use the feature name! Go-To-Definition (or GTD to those of us too busy to spell things out properly) enables you to jump to code and open designers with an easy shortcut. GTD works on code context, which means that if you're on a Table variable and you do CTRL+F12 then the Table Designer will spring open and you can easily review field information or check properties. COOL!

    And if you're on a system trigger (like VALIDATE) and there is code in the Validate trigger, then CTRL+F12 will take you to that method! Awesome!

    Lastly, and by now this won't be much of a surprise, if you're on a user-defined function then pressing CTRL+F12 will take you to that code. Kapow!

    GTD doesn't work for rec or currform/currreport yet but we have room and time for improvements. Let us know if you'd like GTD to take you somewhere else in the app!

    And if you don't like shortcut keys, you can also access Go-To-Definition via right-click or through the View menu!

    Figure 1 - using Go-To-Definition on a Table variable will open Table Designer. Using it on a function will jump to the code for that function.

    2. Lock/Unlock of Application Objects

    Have you ever lost work because the developer sitting next to you modified the object you were currently working on? We can't restore your lost work but we can do something about losing more work in the future. Check out the two new fields in the Object Designer - Locked and Locked By. Now you can 'reserve' or place a lock on an application object and any subsequent developers will now get a 'read only' version of that application object. This means that other developers can still see the code but they can't save and overwrite your work.

    To make sure that no one loses work, a 'read only' object can still be saved and compiled, but you can't overwrite the original ID.

    Look for the client setting in Tools->Options called "Auto lock on Design" to make the feature activate automatically when you open an object.

    Figure 2 - Two users, userA and userB are working in the same database. UserA can see that userB has already locked codeunits 80 and 81 and is trying to lock Codeunit 82.

     3. Page Designer Improvements

    We've tweaked a couple of parts in Page Designer. Firstly, we completed the New Page Wizard so that it will now also offer you to pick factboxes for your pages. This was quite an oversight as factboxes make pages much more valuable than forms as you can include much more related information in them. Next, we changed the default naming of factboxes so that in the page you'll no longer see name and ID as <control20061721008> but instead see a much more readable name like <OutlookPart>. Nice!

    Figure 3 - FactBox picker in the New Page Wizard.

     4. Structure Highlighting

    Finding pages a bit hard to read? Need a microscope to see what's indented and what's not? We agree that it's hard to see where the structure is in pages and so we've introduced Structure Highlighting. Now any record (row) that is a container will be in bold. It's a simple change but it makes a huge difference to the readability of the pages. The bold lines break up the groups and the readability of the page is dramatically increased.

    Figure 4 - Structure Highlighting. Showing a simple example on a small page here because it's hard to include a large page. However, with the container lines highlighted, the overall structure of the page is more readable. And if the page had more containers (FastTab groups, Repeater sections), then they would stand out quite prominently.

    Recently Microsoft hosted a Hot Topic session that included the improvements discussed in this post. It is called  "Microsoft Dynamics NAV 2009 R2 Hot Topic: What's New for Developers." A recorded version of the session can be seen at the Partner Learning Center

    We hope you enjoy the new features and, as ever, if you have suggestions for improvement you're welcome to get in touch (either in comments, directly to me in email: sglasson@microsoft.com, or using the MSConnect feedback tool).

    Thank you!

    Stuart 

  • Microsoft Dynamics NAV Team Blog

    Reusable Bugs

    • 20 Comments

    Here at Microsoft we strive to create reusable and generic solutions, in order to improve efficiency and ship better software. We had revisited some of our best practice principles and had turned them upside down to get a better and more complete view on development in general.

    Description

    It widely known that bugs are unfortunately a commonly found part of software development and that there is no way to create zero-bug software. Knowing that bugs are and will stay a part of software, we have given some thought on how we can improve this aspect.

    It is difficult to come up with new and different bugs in each release, and it is a waste of resources to not use the ones which already had proven successful in the past. To avoid reinventing the wheel, we propose to come up with new innovative ways to create bugs that are reusable and generic enough to be used in various places of the application.

    Examples

    First example

    One example of a reusable bug is to find a heavily used table, like table 36 Sales Header, and observe one of the more important fields of type Option, for example Document Type. The OptionString property has the following value: Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order, which you should update to add one option, for example Transport Order in the beginning.

    The main benefit of this reusable bug is that code changed in one place, has impact in multiple sides on the application: document creation and handling, posting etc. 

    Second Example

    Codeunit 1, ApplicationManagement is a good place for creating reusable bugs. A simple INSERT on the RecRef on the first line of OnDatabaseInsert will create a sure and versatile bug that is reusable all over the application. Redundancy on database insertion ensures that data is surely conveyed to the data storage layer, twice. 

    Third Example

    We are considering to no longer make localization builds for countries. It consumes lab resources to keep running multiple country builds. Instead, we will merge everything into one single build. This is a bigger scale implementation of the "God object". Inside this unique build, we will use IF statements and sporadically CASE statements to select each country's behavior. For more help on how to use IFs, see also the IF .. THEN|ELSE C/AL Coding Guideline. 

    Fourth Example

    When you post a document, make sure that you transfer data to a field that is smaller than the field you are assigning from. This will not immediately be caught and will only hurt a subset of the customers who uses Microsoft Dynamics NAV to its fullest.

    Guidelines

    When it is not entirely obvious how you can add a bug, there is another way to approach the problem. By following some general coding best practices like the ones described below, reliable bug innovation is facilitated and can come naturally as a collateral effect.

    Code structure

    • Put everything in one function and only use comments to explain the structure of your code. And don't use functions - because this only complicates things... having to navigate from function to function, and completely lose track of where you are in the business logic.
    • On top of that .. put everything in one codeunit. Because also that will simplify and make your structure more readable.
    • Use Hungarian Notation on your variables, because at any time, you need to know what type, and what context your variable is on. 
    • Declare all your functions and variables global, so they are available at any time.

    Don’t do Unit Testing

    • Unit testing adds complexity and extra time to the stuff you’re doing. Also, it eats up extra codeunits which means: it costs money. You will never be able to foresee all scenarios possible, so you’re destined to forget and not test everything. So you will save time in not doing unit testing.

    Never add images to actions

    • Because there is an image by default. When you don’t provide an image on an action on a page, the application will foresee a ball... and when you never do it, your application will have a very consistent way of showing your actions, by providing that picture of that ball. On top of that, you’ll save time.

    Do not care about ControlIDs

    • When you’re doing development of your product, do not care about ControlIDs, and just leave the Offset ID to the default value of 0. This way, when merging, you will receive nice notifications, saying both you and Microsoft have added functions in that objects. You can use this feature to document all these places.

    Hooks

    • Never apply the Hook pattern! Hooks will only reduce upgrade time. This means, you will only shortly enjoy using the Application Merge Utilities. The more you change in default application, the longer it takes to upgrade, the longer you will enjoy the toolkit!
    • This can be taken one level higher. Simply you are not hardcore if you do not use notepad to resolve all of the merge issues.

    How to use RecRef

    • Why fuss around declaring specific table variables, just generalize, all you need is one, two, or perhaps three RecRef variables, with a few IFs and CASEs here and there for reflection, to carry you all the way.

    Arguments

    • Using only a few arguments on the functions are a sign of a weak developer. Stick in as many arguments as possible on the function, even if you are not using them, they could be useful in the future.

    Just another field / action

    • Thinking of the design is overrated, each problem can be solved by adding an additional field or the table/page or with adding another action. We all know this has worked well in the past.

    Reusability

    • We have decided that each time we fix a bug, we now also explain how it can be applied as a pattern. We then use anti-virus software to search for these patterns, to make sure we do not re-introduce these bugs anywhere else in Microsoft Dynamics NAV.

    Business logic placement

    • As a best practice, we have also decided to move code into pages. Business logic does not belong in tables and codeunits; instead pages should know and be aware of the context and update it accordingly. As opposed to tables and codeunits, pages are aware of the context. 

    Conclusion

    As the last thing, we are fully aware that this pattern would not have been approved on any other day than April 1st, and we guarantee that on no other days would we support this pattern. Happy April Fools' Day! 

    Disclaimer: this pattern is inspired from IETF documentation published on April 1st, like for example the revolutionizing IP over Avian Carriers standard.

     

    Best regards,

    Bogdana Botez, Andreas Moth, Elly Nkya, Nikola Kukrika, and Eric Wauters 

Page 1 of 51 (763 items) 12345»