Business Central 2022 wave 2 (BC21) new features: Use option access syntax in formulas (18 -> Database::Customer)

Dynamics 365 Business Central

Hi, Readers.
The preview environment for Dynamics 365 Business Central 2022 release wave 2 (BC21) is available. Learn more: Link.

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

Use option access syntax in formulas:

Business value:

When setting up SourceTableViews, TableRelations, and so on that relate to other tables by table IDs (or, less frequently, specify codeunit IDs to run), developers had to specify the integer ID of the target object. This wasn’t user friendly or readable and could be error-prone.

Thus, the AL language now supports using Option Access syntax (names) in formula properties. This removes the need for the hard-coded integer ID values and improves the readability and the maintainability of the code.

https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave2/smb/dynamics365-business-central/use-option-access-syntax-formulas

The AL language now supports using Option Access syntax in formula properties.

Thus, instead of, for example,

SourceTableView = where(“Source Type” = const(18));

it will be possible to use the option name, for example,

SourceTableView = where(“Source Type” = const(Database::Customer));

Let’s see some simple examples.

In SourceTableViews:

In TableRelations:

In SubPageLink:

This was not available in any previous version.

This new feature greatly increases the readability of the code. Give it a try!!!😁

PS:
1. Not yet available in RunPageLink.

2. You can also add objects other than Databases.

3. The standard code for BC 21 Preview is still using hard-coded integer IDs. Perhaps Microsoft will gradually update the code.

Update from Business Central Launch Event (2022 release wave 2) 

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL