¿THE QUESTION? – UPGRADE VS EXTENSIONS – NAV Extensions after the release of Dynamics NAV 2018

Original URL…

he built-in Visual Designer in Dynamics NAV 2018 and Visual Studio Code are expected to replace the familiar C/SIDE environment as a development tool. However, that’s not just a matter of clicking on a button. It means learning a new way of development, a new language (with old components, though) and a new way of deploying customizations.

All customizations, including customizations on top of customizations are going to become Dynamics NAV Extensions; and that’s a good thing for the industry.

.Net users might say, okay that’s how we do things anyway. But, for NAV developers, this is a big change because we are used to changing any existing piece of code.

So why not work towards a model that is as flexible as .Net and solves NAV upgrade issues as well? Let’s not stick with the traditional “copy-paste-modify” but just “reference-and-extend”.

The downside of customizations is that they often introduce challenges when upgrading Dynamics NAV. It’s exponentially harder to upgrade a solution from one version to the next when changes have been made to the underlying solution. Dynamics NAV Extensions, particularly the latest version – Extensions 2.0 – solves this problem.

Instead of defining customizations in the original source code, Dynamics NAV Extensions are written in parallel with the solution source. The integration with the source code is handled with events.

An extension can add new objects and extend existing objects that are present in the solution. The extension code is packaged in a file, which you can easily deploy to your solution. This allows you to upgrade the underlying solution and, as long as the events remain, the extension will behave in the same way from version to version.

With Dynamics NAV 2018, you can have multiple extensions installed. It’s also possible to make a dependency reference from one extension to another. The question is “how?”  When downloading symbols, you’re only getting system and application data.

Please be aware, that several of the extensions installed in NAV2018 are still V1 extensions, and you can reference and download symbols, but the symbol file is empty. So currently it’s not possible to reference a V1 extension from a V2.

 

More Info…

Dynamics NAV solutions can be customized by partners, value-added resellers (VARs), and even some customers. This is an important benefit of the product and the service continues to be available. However, it has traditionally been carried out by overlayering the application code. The move to the cloud with more agile servicing and frequent updates requires a less intrusive customization model that makes updates less likely to impact custom solutions. This new model is called Dynamics NAV Extensions and will probably replace customization.

Dynamics NAV Extensions are a way for Microsoft Dynamics NAV developers and ISVs to extend the functionality of NAV without modifying Microsoft’s original source code. With the new model, when you come to upgrade Dynamics NAV with a cumulative update, you no longer need to merge all the customized objects. That means less upgrade issues.

With NAV Extensions, you can add functionality without changing the standard solution from Microsoft. This has the obvious advantage that major NAV upgrade projects are no longer necessary. Once you are using Extensions, the customizations no longer represent a problem when upgrading to the latest version of the solution.

If you want to prepare for this new model, you should start to work with Dynamics NAV Extensions today.

Barriers to editing Dynamics NAV extensions

Dynamics NAV Extensions are packages that contain additional functionality, report layouts (at least starting in NAV 2017), permissions, and more. The packages can be easily installed, uninstalled and upgraded without affecting the Dynamics NAV source code.

Once the Dynamics NAV extension package has been created, it is no longer easy for others to view the code of the extension, which means that your code is protected. You can view the source code of an extension through the debugger, but you cannot access the code through the development environment and you can’t modify an extension unless you have the source code.

Technically, there is no real problem. The new solution will work and the customer will be able to use the custom functionality. However, if another party wanted to further modify the functionality, it would not be possible because the functionality can only be modified if the developer has the source code.

Evolution of Dynamics NAV Extensions

Dynamics NAV Extensions Version 1

Microsoft Dynamics NAV 2016 incorporated Extensions V1. However, at that stage it was more of a concept than a practical working tool. In reality, it was quite a pain to develop customizations with Dynamics NAV Extensions because you had to restructure code and not all object types could be extended – only pages, tables and code units.

Dynamics NAV Extensions Version 1 did not include:

  • Add-Ins
  • Web services
  • Job Queues
  • Reports
  • Translations and much more

These customizations are usually easy to create using events. So, you can raise an event in your extension and have another extension subscribe to this event, perform certain actions and pass data back. In Extensions V1, this is difficult to do, because you actually need to provide the source code of your extension to everyone who wants to work with your events or with your data structure.

Dynamics NAV Extensions Version 2

Dynamics NAV Extensions V2 helps create a more modern development environment that supports better functionality. You can actually add your events, raise them and then subscribe to them in another extension. You can also use their tables or other functionality without requiring the source code of the base extension.

Microsoft Visual Studio Code downloads the symbols for all dependent extensions. This means, as long you have the base extension installed in your development system and define this extension as a dependent extension, you can subscribe to the event.

How Dynamics NAV Extensions can make Dynamics NAV upgrades easier

We believe that in most cases, NAV Extensions can help developers to upgrade without any problem. Why in most? Because during any Dynamics NAV upgrade we currently carry out (which is classic, nothing to do with Extensions), we can upgrade the most part of the code without conflicts.

What about the exceptions? There are just a few scenarios where you may need to rethink your solution. Here are some examples:

  • When new functionality in an upgraded version of NAV can replace your extension. However, they probably can co-exist.
  • When Microsoft redesigns part of a solution. Even this doesn’t need to be a major problem. If, for example, you are upgrading to NAV2017, a major redesign of CU80 isn’t that much of a problem thanks to the hooks pattern. Decent code design always helps. If you have been using extensions, you would have been using events anyway, so that’s even less of a problem.

Visual Studio Code and Dynamics NAV Extensions

Visual Studio Code (VS Code) is a lightweight source code editor, running on Windows, Mac and Linux. Developing for NAV on your Linux box, doesn’t that sound cool? It has built-in support for JavaScript, TypeScript and Node.js. And it supports extensions (but not NAV Extensions) for other languages, like C#, Python and PHP.

The Microsoft NAV team has created a new VS Code extension that enables the creation of objects in AL language. But beware; creating a VS Code extension for a completely new language is not straightforward! It requires the creation of a model to support intelligence and the creation of a new compiler. That sounds easy, but it is not.

NAV Extensions after the release of Dynamics NAV 2018

The built-in Visual Designer in Dynamics NAV 2018 and Visual Studio Code are expected to replace the familiar C/SIDE environment as a development tool. However, that’s not just a matter of clicking on a button. It means learning a new way of development, a new language (with old components, though) and a new way of deploying customizations.

All customizations, including customizations on top of customizations are going to become Dynamics NAV Extensions; and that’s a good thing for the industry.

.Net users might say, okay that’s how we do things anyway. But, for NAV developers, this is a big change because we are used to changing any existing piece of code.

So why not work towards a model that is as flexible as .Net and solves NAV upgrade issues as well? Let’s not stick with the traditional “copy-paste-modify” but just “reference-and-extend”.

The downside of customizations is that they often introduce challenges when upgrading Dynamics NAV. It’s exponentially harder to upgrade a solution from one version to the next when changes have been made to the underlying solution. Dynamics NAV Extensions, particularly the latest version – Extensions 2.0 – solves this problem.

Instead of defining customizations in the original source code, Dynamics NAV Extensions are written in parallel with the solution source. The integration with the source code is handled with events.

An extension can add new objects and extend existing objects that are present in the solution. The extension code is packaged in a file, which you can easily deploy to your solution. This allows you to upgrade the underlying solution and, as long as the events remain, the extension will behave in the same way from version to version.

With Dynamics NAV 2018, you can have multiple extensions installed. It’s also possible to make a dependency reference from one extension to another. The question is “how?”  When downloading symbols, you’re only getting system and application data.

Please be aware, that several of the extensions installed in NAV2018 are still V1 extensions, and you can reference and download symbols, but the symbol file is empty. So currently it’s not possible to reference a V1 extension from a V2.

Microsoft tools for automatic migration to Dynamics NAV Extensions

To help develop solutions for this new programming environment, you can use a set of new Microsoft developer tools to build, test, and deploy NAV Extensions.

Microsoft In-App Designer

In the client, you can switch to In-App Designer mode. This enables you to change the look and feel of the client quickly and easily. Using this tool, you can define the elements (such as fields or groups) that appear on a page and change how they are displayed. You can also use In-App Designer as an interactive tool to create extensions based on changes you make in the client.

Microsoft In-App Designer includes a wide range of important features, such as:

  • Adding a field from the source table to a page
  • Moving a field to another position on a page
  • Removing a field from a page
  • Previewing your design in desktop, tablet, and phone clients
  • Saving the changes for the tenant or saving as an extension package file in Visual Studio Code.
  • Microsoft Dynamics NAV Developer Preview 3 (Coming soon)
  • Changing the caption of a field on the page.
  • Adding, moving, renaming, and removing an action.
  • Adding, moving, and removing page parts.
  • Adding new pages

Conclusion

Erik Ernst, a Microsoft Dynamics NAV MVP, commented, “Personally, I’m thrilled about these new extensions. Not so much because they are special or fantastic. But because they allow me easily to remove them again, or simply not install them. The future direction is clear. Some years down the road, then we will only have the World-Wide version. Localizations are just Extensions, either coming from Microsoft or ISVs.”

A statement from Microsoft added, “There are no plans to stop partners from modifying NAV. But you can see it as an option to transform gradually and get your developers used to using Dynamics NAV Extensions when possible, which will also have a side effect of making upgrades easier. So it should be more of a journey than a hard point in time when you must move from one way of doing things to another.”

At Simplanova, we truly believe that Dynamics NAV Extensions is the solution for many of the pain points we have today. Maybe they are not completely fixed yet, but in the near future they will be! That applies to on-premise, for customizations, and for your private and public cloud. And guess what, for Dynamics365, they are already there!

Add-on upgrade to extensions has become much more relevant with Microsoft Dynamics NAV 2018 version and Extensions 2.0. If you choose Simplanova services to upgrade your Add-on to NAV Extensions, we will move Dynamics NAV code customization to events and redesign the code for a successful migration from Add-on to Extensions.

Simplanova has long experience in Microsoft Dynamics NAV services for ISV and VAR partners. If you would like to discuss how our Dynamics NAV Extensions service can help your business, just fill in the form below.

The post Dynamics NAV Extensions will make NAV upgrades much easier appeared first on Simplanova.

Anuncios

Upgrading to Microsoft Dynamics NAV 2018

Original URL…

Applies to: Microsoft Dynamics NAV 2018. See Microsoft Dynamics NAV 2017 version.

This topic provides an overview of how to upgrade to Microsoft Dynamics NAV 2018. The upgrade process depends on different factors, such as the version of Dynamics NAV that you are upgrading from, and the degree to which your solution differs from the standard version of Dynamics NAV. The mains tasks range from converting the database to upgrading application code and data.

Use the following table to determine the procedures that you must complete for your upgrade scenario.

Scenario Procedures
Full upgrade from one of the following versions:

  • Microsoft Dynamics NAV 2015
  • Microsoft Dynamics NAV 2016
  • Microsoft Dynamics NAV 2017
  1. Upgrade the Application Code
  2. Upgrade the Data
Full upgrade from one of the following versions:

  • Microsoft Dynamics NAV 2013
  • Microsoft Dynamics NAV 2013 R2
  1. Upgrade to Microsoft Dynamics NAV 2018 Cumulative Update 2:
    1. Download Microsoft Dynamics NAV 2018 CU2.
    2. Upgrade the Application Code
    3. Upgrade the Data
  2. Upgrade to the latest Microsoft Dynamics NAV 2018 cumulative update (CU):
    1. Upgrade the Application Code
    2. Upgrade the Data
Full upgrade from one of the following versions:

  • Microsoft Dynamics NAV 2009 SP1
  • Microsoft Dynamics NAV 2009 R2
  • Microsoft Dynamics NAV 5.0
  • Microsoft Dynamics NAV 4.0
  1. Upgrade to Microsoft Dynamics NAV 2013.
    For more information, see Upgrading to Microsoft Dynamics NAV 2013 in the MSDN Library.Alternatively, you can upgrade from Microsoft Dynamics NAV 2009 SP1 or Microsoft Dynamics NAV 2009 R2 to Microsoft Dynamics NAV 2015 as described on the Dynamics NAV Team Blog.
  2. Upgrade to Microsoft Dynamics NAV 2018 Cumulative Update 2.
    1. Download Microsoft Dynamics NAV 2018 CU2.
    2. Upgrade the Application Code
    3. Upgrade the Data
  3. Upgrade to the latest Microsoft Dynamics NAV 2018 cumulative update (CU) by following steps a and b above.

After the upgrade, links between interaction records and logged email messages is lost. To resolve this issue, the administrator has to log all mails again to restore the links. For more information, see Logging Interaction Links are Lost When You Upgrade from Microsoft Dynamics NAV 2009 R2.

Technical upgrade of Microsoft Dynamics NAV 2018 database to a new platform version with no application changes, such as with a cummulative update

You can also use this procedure to convert a previous Dynamics NAV database to Microsoft Dynamics NAV 2018 technical requirements, and then upgrade the application and data later.

Before you begin the upgrade process, see Upgrade Considerations for tips about things to consider when you prepare to upgrade to Microsoft Dynamics NAV 2018.

Automating the Upgrade Process using Sample Windows PowerShell Scripts

You can use Windows PowerShell scripts to help you upgrade to Microsoft Dynamics NAV 2018. You can use automation to upgrade a single Dynamics NAV database as well as multiple Dynamics NAV databases that use the same application. Microsoft Dynamics NAV 2018 provides sample scripts that you can adapt for your deployment architecture. For more information, see Automating the Upgrade Process using Sample Windows PowerShell Scripts.

See Also

Product and Architecture Overview
Migrating to Multitenancy
Deployment
Transforming Forms to Pages

Upgrading to Dynamics NAV 2018 from Dynamics NAV 2013 or Dynamics NAV 2013 R2

Original URL…

If you want to upgrade a customer’s database from Dynamics NAV 2013 or Dynamics NAV 2013 R2, you may have noticed that the latest Dynamics NAV 2018 cumulative update does not have a direct path to upgrade from these earlier versions.

The solution is to upgrade to Dynamics NAV 2018 Cumulative Update 2, and then upgrade to the latest Dynamics NAV 2018 cumulative update.

For more information, see Upgrading to Dynamics NAV 2018, which has been updated accordingly.

We hope this helps those of you who have been confused about Dynamics NAV 2018 Cumulative Update 3, and we apologize for the experience you had. Going forward, please use the processes outlined in Upgrading to Dynamics NAV 2018.

Cómo utilizar Upgrade Codeunits en NAV 2017

Original URL…

Desde la versión 2015 de Microsoft Dynamics NAV hasta la presente, se han venido incorporando al producto bastantes novedades a nivel de desarrollo. Después de haber pasado cierto periodo de madurez, inexplicablemente algunas de éstas no han gozado de tanta popularidad como merecieran, aún siendo tremendamente útiles. Una de estas características es la utilización de upgrade codeunits.

Habitualmente nos habremos topado con este concepto en los entornos de migración de versiones de NAV, como parte del proceso estándar de actualización de datos.

Sin embargo, podemos utilizar esta técnica en tareas más mundanas o habituales, siempre que haya que actualizar la estructura de una o varias tablas.

Un sencillo escenario habitual

Para ilustrar el uso de upgrade codeunits, vamos a realizar un ejemplo simplificado a partir de un escenario muy sencillo.

Imaginemos que tenemos una tabla en NAV, con la siguiente definición de campos:

Cómo utilizar Upgrade Codeunits en NAV 2017

Esta tabla, en el entorno de producción de nuestro cliente, contiene datos:

Cómo utilizar Upgrade Codeunits en NAV 2017

Sobre esta tabla, queremos hacer un cambio en su estructura. Concretamente, queremos cambiar el ID, el nombre, y el tipo de datos del último campo, de forma que la tabla resultante quede así:

Cómo utilizar Upgrade Codeunits en NAV 2017

Vamos a suponer que ya hemos realizado los cambios en esta tabla en un entorno de desarrollo, y ahora queremos actualizar el entorno de producción del cliente. Como hemos visto, en el entorno de producción esta tabla actualmente contiene datos, así que no podemos cambiar su definición tan fácilmente si no queremos perderlos.

Veamos cómo podemos llevar a cabo esos cambios sin perder información.

Cara a cara con el problema

Si intentásemos actualizar esta tabla en el entorno del cliente importando un fichero .fob con la tabla modificada, nos toparemos con este problema.

El sistema detectará que hay cambios potencialmente destructivos en la nueva tabla que estamos importando, y nos avisará de ello.

Cómo utilizar Upgrade Codeunits en NAV 2017

[ Recordemos las opciones de sincronización. Si elegimos la opción Synchronize Schema… Force, estaremos obligando a NAV a actualizar la tabla sí o sí, perdiéndose el contenido de los campos modificados. Evidentemente no es eso lo que queremos. ]

Cómo utilizar Upgrade Codeunits en NAV 2017

La sincronización, evidentemente, fallará:

Cómo utilizar Upgrade Codeunits en NAV 2017

Cómo utilizar Upgrade Codeunits en NAV 2017

Y la tabla nueva se habrá importado, pero como su esquema no se ha sincronizado con SQL Server, no podremos utilizarla. Y entonces sí tenemos un problema.

Cómo utilizar Upgrade Codeunits en NAV 2017

Vamos a ver qué tendríamos que haber hecho para actualizar correctamente los objetos sin perder datos.

El proceso de actualización de datos

Vamos a seguir estos pasos.

  • En nuestro entorno de desarrollo, lo primero que vamos a hacer es crear una copia de la tabla afectada, que llamaremos Temp Mov. Proceso. Esta nueva tabla tendrá necesariamente los mismos campos clave que la original, y el campo o campos que se vayan a modificar. El resto de campos y todo el código asociado a triggers no será necesario.

En nuestro caso tendremos esta nueva tabla:

Cómo utilizar Upgrade Codeunits en NAV 2017

  • Realizamos los cambios en la tabla original, quedándose finalmente así:

Cómo utilizar Upgrade Codeunits en NAV 2017

  • Creamos una nueva codeunit. Será nuestra Upgrade codeunit.

Deberemos marcar la propiedad Subtype = Upgrade.

Cómo utilizar Upgrade Codeunits en NAV 2017

Esta codeunit deberá tener al menos dos funciones:

  • Una función que sirva para copiar y guardar los datos actuales de las tablas afectadas por la actualización, en otra tabla o tablas temporales. Esta función tendrá la propiedad FunctionType = TableSyncSetup.
  • Una función que sirva para, a partir del contenido de las tablas temporales que hemos guardado anteriormente, restaurar (con o sin manipulación previa) los datos a la nueva estructura de datos de la nueva tabla. Esta función tendrá la propiedad FunctionType = UpgradePerCompany (caso más habitual) o UpgradePerDatabase.

Opcionalmente es posible crear una tercera función para comprobar que se cumplen ciertas precondiciones que indicaremos nosotros, antes de realizarse la actualización de datos. Esta función deberá tener la propiedad FunctionType = CheckPrecondition.

  • Creamos la función para guardar los datos en la tabla temporal. Es necesario marcar la propiedad FunctionType = TableSyncSetup, y añadir como parámetro por referencia un registro de la tabla virtual 2000000135 Table Synch. Setup. [ También necesitaremos una variable local que apunte a la codeunit 9900Data Upgrade Mgt. ]

Cómo utilizar Upgrade Codeunits en NAV 2017

Cómo utilizar Upgrade Codeunits en NAV 2017

  • Este paso es opcional. Hemos decidido que el sistema no permitirá actualizar los datos si hay registros en la tabla Lín. Diario General, así que hemos creado una función de testeo de precondiciones. Hemos de marcar la propiedad FunctionType = CheckPrecondition.

Cómo utilizar Upgrade Codeunits en NAV 2017

Cómo utilizar Upgrade Codeunits en NAV 2017

  • Por último, escribimos una función que lee los registros de la tabla temporal, y los devuelve a los nuevos campos o campos modificados de la tabla original. Es necesario que esta función tenga la propiedad FunctionType = UpgradePerCompany.

Cómo utilizar Upgrade Codeunits en NAV 2017

Cómo utilizar Upgrade Codeunits en NAV 2017

  • El resultado final de nuestra upgrade codeunit será algo así:

Cómo utilizar Upgrade Codeunits en NAV 2017

  • Exportamos estos objetos a un fichero .fob: Nuestra tabla modificada, nuestra tabla temporal, y nuestra upgrade codeunit.

Cómo utilizar Upgrade Codeunits en NAV 2017

  • Abrimos el entorno de producción del cliente, o aquél que queramos actualizar, e importamos el fichero .fob:

Cómo utilizar Upgrade Codeunits en NAV 2017

Elegimos sincronización con Validación:

Cómo utilizar Upgrade Codeunits en NAV 2017Cómo utilizar Upgrade Codeunits en NAV 2017

Cómo utilizar Upgrade Codeunits en NAV 2017Cómo utilizar Upgrade Codeunits en NAV 2017

  • Inmediatamente después, realizamos la actualización de datos, invocando manualmente la opción Herramientas –> Actualización de datos –> Iniciar…:

Cómo utilizar Upgrade Codeunits en NAV 2017Cómo utilizar Upgrade Codeunits en NAV 2017

Cómo utilizar Upgrade Codeunits en NAV 2017

  • Y ya hemos terminado. Hemos actualizado la estructura de la tabla Proceso sin perder los datos. Podemos comprobarlo:

Cómo utilizar Upgrade Codeunits en NAV 2017

Comentarios adicionales

¿Qué ha pasado con nuestra función de tipo CheckPrecondition? Si la base de datos destino no hubiese cumplido los requisitos (en nuestro caso, no debería haber registros en la tabla Lín. Diario General), el proceso de actualización se hubiese detenido con un error, y tendríamos que usar los comandos de Powershell para averiguar el motivo del mismo:

Cómo utilizar Upgrade Codeunits en NAV 2017Cómo utilizar Upgrade Codeunits en NAV 2017

Conclusión

Aunque la solución a este tipo de escenarios puede implementarse por código realizando usualmente varios procesos manuales (a los que estamos más que habituados), conviene plantearse la utilización de upgrade codeunits en aquellos casos en los que el volumen de datos a actualizar sea muy grande, o tengamos varias empresas.

Sus principales bazas residen en su alto rendimiento de proceso y en la posibilidad de semiautomatizar su ejecución mediante los comandos de Powershell.

Como siempre, estoy abierto a críticas constructivas. Así que podéis hacernos llegar vuestros comentarios o correcciones respecto a este artículo con total libertad. Un saludo.

Upgrade Codeunits

You use upgrade codeunits when you make changes to a table definition, either from the Microsoft Dynamics NAV Development Environment or during an upgrade. Upgrade codeunits migrate existing business data from the old table structure into the new table structure. An upgrade codeunit serves the following purposes:

  • Provides instructions for how to handle data changes to a table during schema synchronization. For more information, see Synchronizing Table Schemas.
  • Provides the logic for migrating existing data in the business data table from the old format to the new format after schema synchronization.
  • Provides instructions for updating custom report layouts to dataset changes. For more information, see Updating Custom Report Layouts by Using Upgrade Codeunits.

A typical example of when to use an upgrade codeunit is when you remove a field from a table definition and you do not want to lose the existing data in the business data table. Instead, you want to use it somewhere else in the new application.

You implement upgrade codeunits when you make destructive changes to tables in Microsoft Dynamics NAV Development Environment. For more information about destructive changes, see Handling Destructive Changes With Table Schema Synchronization. After you have created an upgrade codeunit to handle table changes, you can use it when you upgrade data from an earlier version of Microsoft Dynamics NAV to the current version. A single upgrade codeunit will typically contain table schema synchronization instructions and data migration logic for multiple tables that have changed from one version of Microsoft Dynamics NAV to another. More…

How I Reduced Data Upgrade Time By 78 Hours

Upgrade projects are lots of fun. They are full of challenges that keep you busy day and night all the time. More…

As Rashed said, you need some time for standard object upgrade. testing data and additional training. But the main time for this upgrade project depends of customization level. I made the same upgrade (almost without any customization) and small database for one week. But I have upgrade project with really many customizations (only classic used) in 3-4 months. Depends of number and complexity of customization. This is my experience. Aleksandar Totovic .                  

Upgrade Considerations

Depending on which version you are upgrading from, and the degree to which your solution differs from the standard version of Microsoft Dynamics NAV, you may want to prepare your solution for the upgrade. This topic provides tips for things to consider when you prepare to upgrade to Microsoft Dynamics NAV 201X. More…