The public preview for Dynamics 365 Business Central 2023 release wave 1 (BC22) is available. Learn more: Link.
I will continue to test and share some new features that I hope will be helpful.
In this post, I would like to talk about Event navigability. This new feature is not mentioned in the 2023 wave1 release plan, but it is in Business Central Launch Event (2023 release wave 1).
As you might know, you create an event subscriber method just like other methods except that you specify properties that set up the subscription to an event publisher. The procedure is slightly different for database and page trigger events than business and integration events. Business and integration events are raised by event publisher methods in application code. Trigger events are predefined system events that are raised automatically on tables and pages.
More details: Subscribing to Events
|Specify the type of object that publishes the event. This argument can be ||no|
|Specify the object that publishes the event. You can set this argument to the ID, such as ||no|
|Specify the name of method that publishes the event in the object that is specified by the ||no|
|Specifies the table field that the trigger event pertains to. This argument only requires a value for database trigger events, that is, when the ||no|
|Set to ||yes|
|Set to ||yes|
And, so far event subscriber arguments has been using string literals, and no navigability.
‘<eventpublishername>'(single quotes): ‘OnAfterConfirmPost’
With this release, this has changed, event subscriber arguments now use identifier syntax.👏👏👏
<eventpublishername> or “<eventpublishername>”(double quotes): OnAfterConfirmPost
This means that powerful VS Code navigation features are unlocked.
Let’s see more details.
We can go to difinition (F12) to jump to event publisher.
We can use Go to References (Shift + F12) to see all uses.
We can see the tooltip on event publisher name in event subscriber.
Microsoft has also prepared new AL Code Actions to convert the name. You can run on specific EventSubscriber instace, active file, active project, or workspace.
More details: Using AL Code Actions
Very nice! Give it a try!!!😁
Business Central Launch Event (2023 release wave 1)
Session: What’s new in VS Code and AL (It is recommended to check out the Business Central Launch Event directly to learn more about new features)
The 2023 wave 1 release plan has been updated.
Code navigability on event subscribers
Events are a core concept of extensibility in AL. Until today, the event publisher parameter in event subscribers has been allowing string literals only. Due to this, the target reference has not been known in the AL authoring context, with the result that a developer hasn’t been able to use standard Visual Studio Code navigation support such as Go To Definition or see references inline.https://learn.microsoft.com/en-us/dynamics365/release-plan/2023wave1/smb/dynamics365-business-central/code-navigability-event-subscribers
Now the parameter supports being an identifier instead, allowing full navigability and increased developer productivity.
Hope this will help.
Thanks for reading.