Code navigability on event subscribers

Important

This content is archived and is not being updated. For the latest documentation, go to What's new and planned for Dynamics 365 Business Central. For the latest release plans, go to Dynamics 365, Power Platform, and Cloud for Industry release plans.

Enabled for Public preview General availability
Admins, makers, marketers, or analysts, automatically Mar 1, 2023 Apr 1, 2023

Business value

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.

Now the parameter supports being an identifier instead, allowing full navigability and increased developer productivity.

Feature details

Event subscriber arguments now use identifier syntax instead of string literals. This unlocks powerful Visual Studio Code code navigation features.

Tooltip support

For example, take advantage of the new tooltip on event publisher name in event subscriber to see a definition of the targeted event publisher.

Tooltip on event parameter in Event Subscriber shows definition of the targeted Event Subscriber

Code Lens for where used

You can also use Code Lens to see how many incoming references there are for a given event publisher.

CodeLens shows number of references to event publisher

Go To References

Use the Go To References view to see and navigate to all references on an event publisher.

Go To References view for event publisher

Code action to convert from string literal to identifier

Due to the change in syntax between string literals (single quotes) and identifiers (no quote, or double quotes if names contain spaces), there's a need to convert the event definition name to see the benefit of new navigability. For this, there's a new code action that can be run just on the specific EventSubscriber instance, the active file, the active project, or the whole workspace. This makes it easy and controllable to opt in to the new syntax. Use the new code action to convert existing event parameters in event subscribers from string literal to the new identifier format.

Code action to convert event parameter in event subscribers from string literal to identifier

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.

Thank you for your idea

Thank you for submitting this idea. We listened to your idea, along with comments and votes, to help us decide what to add to our product roadmap.

See also

Subscribing to events (docs)