topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

Using events

Events in Business Central AL development: 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 through events.

Path: Development > Extensibility > Using events · tier official · system development · narrative reviewed (checked by Opus)

Overview

Events let components communicate in a loosely coupled way. A publisher defines an event, code raises it by calling the publisher method, and subscribers react with custom logic. The section covers the full cycle: the kinds of events (business, integration, global, database and page trigger events), how to publish them, how to raise them, and how to subscribe with the EventSubscriber attribute.

Start with Event types and Event example for the concepts, then Publishing Events, Raising Events and Subscribing to events for the mechanics. Events discoverability shows how to use the Event Recorder to find which events to subscribe to. Isolated events explain error handling when a subscriber fails.

Further pages cover related tasks: deprecating external business events so integrations can move to replacements, showing nonintrusive UI messages with the Notification data type, and a walkthrough that implements new workflow events and responses.

Key points

  • Event types include business events, integration events, global events, and database and page trigger events.
  • Publisher methods are created in AL objects such as codeunits, pages and tables, using the BusinessEvent or IntegrationEvent attribute.
  • Subscribers use the EventSubscriber attribute; the EventSubscriberInstance property is also covered.
  • Event Recorder captures events while a scenario runs and generates AL snippets for subscribing.
  • Isolated events let the publisher continue if a subscriber fails; the subscriber’s errors are rolled back without affecting others.
  • External business events are deprecated by marking them obsolete pending first and removing them in a later version (page lists version 27.0), using the Obsolete and ExternalBusinessEvent attributes and a DisplayName prefix.
  • Notifications use the Notification data type with Message, Scope, Send, AddAction, SetData and GetData methods in the web client.
  • A walkthrough shows how to add 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.
  • 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 10 Learn pages

Show 2 more