Dynamics 365 Business Central 2022 Wave 2 – Use option access syntax in formulas

With each update of Dynamics 365 Business Central, Microsoft enhances what is often referred to as the base application and enhances the development environment. Dynamics 365 Business Central 2022 Wave 2 has several exciting Development features for runtime 10.0. One of the exciting features is to Use option access syntax in formulas.

AL Development in Microsoft Dynamics 365 Business Central allows option access syntax for referencing objects throughout the language. Object option access simplifies the reference and readability of code when an ObjectID value is required.

For example, the syntax of the EventSubscriber attribute is
 
[EventSubscriber(ObjectType: ObjectType, ObjectId: Integer, EventName: Text, ElementName: Text, SkipOnMissingLicense: Boolean, SkipOnMissingPermission: Boolean)]
When writing code in AL, you can use either the object number or option access syntax for the object in the ObjectID parameter. I have always wondered why this option has not been possible in formulas property values.
[EventSubscriber(ObjectType::Codeunit, 12, 'OnAfterInitVendLedgEntry', '', true, true)]
or 
 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterInitVendLedgEntry', '', true, true)]

It is much easier on the eyes.

Dynamics 365 Business Central 2022 Wave 2 adds the option to use option access syntax in formulas. Before we had to write

and now we can write

Read more about the feature Use option access syntax in formulas here.

Note: The code and information discussed in this article is for informational and demonstration purposes only. This content was created referencing Microsoft Dynamics 365 Business Central Public Preview 2022 Wave 2 online.

Leave a Reply

Your email address will not be published.