Discover everything you need to know about Empowered, from its offerings to the community and commitment it brings.Weiterlesen
Transitioning from Dynamics NAV/Business Central C/AL to AL: steps to make
Thursday, May 14, 2020
Reading time: 8 minutes
This is the second part of the blog post “C/AL to Extension transition alternatives: how to choose wisely.” In the first part, we reviewed the three alternatives to transition from C/AL to AL. If you haven’t read Part 1 yet, check it out now! In this blog post, we will look closer at the transition steps you need to make when moving custom functionality from C/AL to Extension in AL.
Limitations to transitioning from C/AL to Extension
When planning the transition to Extension, the first question that comes up is: “What limitations will I have to solve to move a solution from C/AL to AL?” The answer is this:
The above list contains all C/AL to AL limitations that we identify at Companial with the specific tools. We will discuss some of these limitations later in this blog post. In addition, you can download the entire limitations list on the Companial website, C/AL to Extension Analyzer page.
At Companial, we have split these limitations into the specific transition steps that we recommend making for the optimal solution transition from C/AL to AL.
How C/AL to AL limitations are spread according to the specific transition steps
The first step in the transition to the Extension project is done in the C/AL coding language, and it is a Cleanup of the solution
The cleanup involves removing any unused functionality from the Business Central solution still on C/AL, such as unused variables, functions, and objects. As a result, when moving from C/AL to AL, you will have a lot less code to reimplement.
Moving From C/AL To AL
The next step is to move from C/AL to AL.
When moving from C/AL to AL, the first thing that needs to be done is for all the current solution’s C/AL code to be moved to the “New Syntax”:
Wondering how the New Syntax compares to the old one?
The differences are visible in the image above:
But can this object be re-imported to Business Central? The answer is “no”. If you have the text objects with the New Syntax, you will not be able to reimport them back directly to NAV/Business Central.
When you have both your solutions (standard solution and custom solution) on the New Syntax, the next step is to investigate both solutions and to check what differences the custom solution has when comparing it to the standard Business Central solution.
Get the deltas between the two solutions
To get the differences between the standard and custom solutions, you have to compare them.
Run Text2AL and get the .al objects
After you get the deltas between the two solutions, use the Microsoft-provided Text2AL tool, which creates most of the AL objects from the deltas. The keyword is “most”, because not all modifications (deltas) are moved automatically. For example, if you have any conflicts in those deltas when you compare the custom and standard solutions, these deltas will not be moved to the AL automatically. This means that you will have to move these differences manually, code by code, into the new Extension solution. This is done in a couple of steps called “Move to Events” and “Base App Modifications”.
Move to Events
This step involves two parts:
There are several limitations that can occur when moving code to the event architecture. For example, if you have any new parameters added to a standard function, you will not be able to move these modifications into the Extensions easily, and some type of reimplementation will be required. Among the most common limitations are Exit functions, which are not easily reimplemented to Events. These functions work differently when being executed in different scopes. For example, if an Exit function is executed in an object trigger, the code after the Exit function will not be run, but if it is executed in a subscriber, it is only going to escape from the subscriber scope, not the trigger on which the subscriber is called. Therefore, these Exit functions might need to be reimplemented with handlers. In such a case, when you have some code that you are not able to move, you need to start thinking about what modifications you should leave in the Base App.
Base App Modifications
The Base App modifications are changes that are left in the Base Application that could not be moved to Extensions. There are a couple of scenarios where you may need to leave code in the Base Application.
When moving from C/AL to AL, most customers will be using the Windows Client with their C/AL solution. But since the release of Business Central 150, the Windows Client has been discontinued. This means that some functionality that may not be available on the Web Client will need to be reimplemented.
With the Web Client comes additional limitations. One of those limitations is .NET RunOnClient functionality. Therefore, if you have any type of this functionality, you will not be able to run that specific code in your Extension. You will get an error and you will have to reimplement this functionality. Also, any File Upload- or Download-related functions in the solution will have to be reimplemented for the solution to work. As this reimplementation on the situation can differ, you might have to use Azure functions or a different type of storage.
After the Web Client step, you need to start thinking about data migration.
The data migration is not as easy as it used to be before, and it may cause some additional issues. One of the reasons is that in Extensions a different type of storage is used. For example, if you are moving from C/AL to C/AL, all modifications are made directly on tables. In AL, if you have an Extension, an additional companion table is created with the same primary keys and you’ll need to think how to move this data. Here you can refer to Microsoft documentation which goes in depth on how to migrate from C/AL to AL.
After the data migration part, you are ready to use the solution on-premise.
But what if you want to use the solution on SaaS? Or publish the solution on AppSource? In such a case, additional steps are required.
Getting ready for SaaS
We always recommend moving to the newest Business Central On-Premise release and then moving to SaaS from there. In addition, you need to complete the following steps:
How Companial can help
At Companial we have the C/AL to Extension Analyzer. It is a self-service which analyzes the solution in 1 day and provides the report which identifies a list of conflicts that Dynamics partners might encounter while transitioning the solution from C/AL to an Extension in AL. Next to that, it recommends a resolution for each conflict based on Companial best practices. The report helps to easily calculate how much effort is required by you or your technology partner to move the solution to an Extension. The overview of this report is free of charge and to get it, all you need to do is upload the solution now for analysis.
You can also watch Mantas Paskevicius’ webinar recording on this topic on YouTube.