Technical Code Changes in Microsoft Dynamics 365 Business Central 2022 Release Wave 1
Wednesday, May 04, 2022
Reading time: 8 minutes
April 1st was the official release day of Microsoft Dynamics 365 Business Central 2022 Wave 1 (version 20). You can review the list of new and planned functionality and the list of functionality that has been moved, removed, or replaced by Microsoft. Along with newly introduced and changed functionalities, there have also been a lot of code changes made, which I will review in this blog post. These include:
When comparing the total obsolete code in the current Dynamics 365 Business Central version with the previous one, we see a decrease in the number of obsoletions that are still in the code. This means that a lot of obsolete code has now been removed from the application.
All obsolete code in Dynamics 365 Business Central is marked with a TAG showing in which Business Central version the code was obsoleted. We can see that in the earlier Business Central versions, the number of obsoletions was mainly growing, but now it’s staying the same or slightly decreasing.
There are 200 obsolete code lines in Business Central v. 17 that are no longer available in the current version. In addition, a lot of new obsoletions have been made in the places where new functionality replaces the old. There are 123 new object changes in the current version and most of them will be removed in the future. I predict that 31 lines of obsoleted code will be removed in Business Central v. 23, which could arrive in as soon as a year and a half from now.
Microsoft is now coming into a motion of removing things that are old and introducing new parts in the software. If you are developing software in Business Central, you should always check for obsoletions. If you get a warning in Visual Studio Code that you are using an obsolete function or obsolete object, you should consider replacing it in your next version, otherwise your added code will not work in the future. If you struggle to make adjustments on time and there is the risk of extension maintenance tasks taking over and obstructing other tasks, check out Companial’s Extension Maintenance service.
Microsoft is in the process of moving some code from the base application to dedicated apps. In this version, there is a newly added Exchange Rate Adjustment app. Even though the exchange rate adjustment functionality is still in the base application, it is now technically in a separate app, allowing you to leave it out of your solution.
The other application change is newly added Events for reporting:
Also as part of the application changes, new tooling has been introduced for Microsoft Dynamics Partners:
When the Performance Profiler window opens, click on “start”, ask the user to complete the action that is giving a performance issue, and, once it’s done, go back and click on “stop”.
After that, in the Performance Profiler you will be able to see the graph showing which resources in the application have been used, and get all the technical information, including the objects and Events that were used during the process.
As this performance tooling is for the current user only, and cannot be started from your support station at a user’s session, you can download the analysis results file and analyze it separately. More advanced options for this tooling are coming in the next Business Central version.
AL Language Changes
In Dynamics 365 Business Central 2022 Release Wave 1 isolated Events have been introduced. Previously, when an Event subscriber ran into an error, a message came up and the application stopped. But in some cases – for example, when the user is opening their client and some apps run into a problem – you want the application to continue. So, in the base application, Microsoft has introduced a new type of Event, called an isolated Event OnCompanyOpenCompleted. From now on, even if one Event subscriber fails, all other subscribers to that Event will be called and the application will continue running.
The other change in the AL language is a new section in the report object in AL language – “Rendering”. Until now, in the report objects, it was possible to define either an RDLC layout or a Word layout. The current version allows multiple layouts of the same type within one report. For example, you can now have multiple RDLC layouts in one report.
One more change in AL language is Elevate permissions, an option that works On-Premises only. In the earlier versions of Business Central, the permissions could be assigned to the objects, such as a Table, a Codeunit, or a Page. Now, permissions can be assigned to a procedure in a Codeunit. This means You can have a procedure that can do something that the current user does not have permissions to do. As an example: you can attribute a procedure with [InherentPermissions (PermissionObjectType::Table, Table::”Retention Period”, ‘ri’)] to let the procedure read from and insert into ‘Retention Period’ table, even if the user does not have this permission.
Developer Experience Changes
One other recent change is the AL-Go for GitHub repository. It provides tools to set up continuous development and continuous integration pipelines, and everything else you need to manage your app from within GitHub. You don’t need to know much about GitHub and about pipelines to get it working – it is rather extensively documented for your reference. You can also read more about AL-Go for GitHub in Freddy Kristiansen’s blog post.
In addition, you can now deploy dependent projects that are in your workspace. In the earlier Dynamics 365 Business Central versions, if you had a workspace that had several apps that depend on one another, you were required to first install one app before that dependency could work. Now, Visual Studio Code can deploy all these apps in one go.
Dynamics 365 Business Central can now send telemetry data to application insights, where you can analyze all the telemetry Events that are sent to you and find trends and exceptions in the activity in your customers’ environments.
If you have telemetry from your app, you can now add default common custom dimensions. For example, if your app requires you to use divisions, you can have the division code always added to your telemetry. By default, Microsoft automatically adds the company name that you are using as a custom dimension in LogMessage function. This helps you analyze your application insights data by where that data is coming from.
In addition, now you can also monitor the use of features that Microsoft has provided in Dynamics 365 Business Central, and you can see if your customers are enabling new features in Business Central.
The other change is that users can now vote on the usefulness of error messages, and this is logged into telemetry. In the error messages, there are thumbs up and thumbs down buttons, allowing your users to tell you if they find the error message that you provided useful or not. Based on that, you can decide to update your messages.
If you’d like to better understand the telemetry and other technical, functional, and administrative, platform enhancements of the latest Dynamics 365 Business Central release, as well as gain insights into the advantages it brings to customers, listen to the webinar on this topic here. You can also visit our website and find out how we can help Dynamics Partners to upgrade and maintain solutions in Dynamics 365 Business Central.