Business Central 2024 wave 2 (BC25): Run code action for ‘with’ for file, project, or workspace

Dynamics 365 Business Central

Hi, Readers.
The public preview for Dynamics 365 Business Central 2024 release wave 2 (BC25) is available. Learn more: Link.

I will continue to test and share some new features that I hope will be helpful.

Run code action for ‘with’ for file, project, or workspace:

Business value:
Businesses are finding ways to create recurring revenue streams by selling goods and services on a subscription basis. This release lets you manage subscription contracts in Business Central. The new subscription module lets you spend more time selling and less time organizing and invoicing contracts.

https://learn.microsoft.com/en-us/dynamics365/release-plan/2024wave2/smb/dynamics365-business-central/run-code-action-file-project-or-workspace?wt.mc_id=DX-MVP-5004336

The AL Language extension offers users the option to help fix issues in code. Code Actions is a Visual Studio Code feature providing the user with possible corrective actions right next to an error or warning. If actions are available, a light bulb appears next to the error or warning. When the user clicks the light bulb (or presses Ctrl+.), a list of available code actions is presented.

So, Code Actions provides possible corrective actions which will help the developer to code in a better way.
More details:
1. Using AL Code Actions
2. New AL Code Action for multiple layouts (Convert RDLCLayout/WordLayout/ExcelLayout to Rendering report session)

And as you might know, the extensibility model and the AL programming language are successors to the C/AL language. And the with statement has up until now been supported in AL. While using the with statement might make code harder to read, it can also prevent code in Business Central online from being upgraded without changes to the code or even worse – upgraded, but with changed behavior. So Microsoft deprecated it in recent versions. More details: Deprecating explicit and implicit with statements.

Fix explicit with statements and Fix implicit with statements functions are also supported in AL Code Actions. For example,

Convert the ‘with’ statement to fully qualified statements:

Qualify with ‘Rec’ -> All occurrences in this object:

PS: Please disable NoImplicitWith feature when using this AL Code Action. If it is an error message, the AL Code action will not be prompted. More about NoImplicitWith feature: Business Central 2022 wave 2 (BC21) new features: Enable NoImplicitWith feature by default (New feature setting in app.json file)

Previously, Microsoft added generic support for running code actions on the active document, active project, or the complete workspace. This has been adopted by code actions, which are used for converting uses of ApplicationArea or tooltips. More details: Business Central 2023 wave 1 (BC22): Code actions for refactoring ApplicationArea property

With this wave (BC25), the code action to convert the usage of with can now be run on the entire document, the active project, as well as the complete workspace level. This makes it much more productive to convert the usage of with statements in existing code to use explicit records.

Small update, but it makes life easier. Give it a try!!!😁

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL