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

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