topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

Events

Events in AL for Business Central: event types, publishing, raising and subscribing, isolated events, discovering events with Event Recorder, deprecating external business events, UI notifications, and a workflow events walkthrough. It answers how to extend application behavior without changing the original code.

Path: Development > Programming in the AL language > Events · tier official · system development · narrative reviewed (checked by Opus)

Overview

Events let AL code react to actions in other code without modifying it. A publisher defines an event, code raises it by calling the publisher method, and subscribers handle it with custom logic. The section covers business, integration, internal, global and trigger events.

Start with “Events in Microsoft Dynamics 365 Business Central” and “Event types” for the concepts, then “Event example”. The pages on publishing, raising and subscribing give the mechanics. “Isolated events in AL” explains how a failing subscriber is kept from affecting the publisher.

Further pages cover finding events to subscribe to with the Event Recorder, and deprecating external business events so integrations can move to replacements. The notifications page covers nonintrusive UI messages. The workflow walkthrough shows new workflow events and responses built with event subscribers.

Key points

  • Event kinds: business, integration, internal, global, and database and page trigger events. Business, integration and internal events use the BusinessEvent, IntegrationEvent and InternalEvent attributes.
  • Publishers are methods in objects such as codeunits, pages and tables; raising an event means calling the publisher method, which triggers all subscribers.
  • Subscribers use the EventSubscriber attribute; the EventSubscriberInstance property is covered on the subscribing page.
  • Isolated events roll back errors in a subscriber without affecting the publisher or other subscribers.
  • The Event Recorder captures events during a scenario and gives AL snippets for subscribing.
  • External business events are deprecated by first marking them obsolete pending and then removing them in a later version, using the Obsolete and ExternalBusinessEvent attributes and a DisplayName prefix; the page references version 27.0.
  • Notifications use the Notification data type with Message, Scope, Send, AddAction, SetData and GetData methods in the web client.
  • A walkthrough shows implementing new workflow events and responses by registering them through event subscribers.

Learn pages

  • Deprecate external business events: Learn how to deprecate external business events in AL for Business Central.
  • Event example: This article shows a simple example of how to use events in Business Central.
  • Event types: Business Central supports different types of events including BusinessEvent, IntegrationEvent, Global, and trigger events.
  • Events discoverability: Using the Event Recorder, you can record the events that are published and raised while performing the actions of your scenario.
  • Events in Microsoft Dynamics 365 Business Central: Events are a programming concept that can ease application upgrade and limit the code modifications in customized applications during platform changes.
  • Isolated events in AL: Describes how isolated events work in Business Central.
  • Notifications: Learn how to use notifications in the development environment to send nonintrusive information to the user interface in Business Central.
  • Publishing Events: This article describes how to create an event publisher method to publish business and integration events.
  • Raising Events: This article describes how to modify the application to raise an event in Dynamics 365 Business Central.
  • Subscribing to events: Designing event subscribers in AL for Business Central.
  • Walkthrough: Implementing New Workflow Events and Responses: Learn how you can extend the native workflows by adding workflow events and responses in code to support additional business scenarios.

Videos, posts and code changes

Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.

Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.

What Learn documents here 8 of 11 Learn pages

Show 3 more