Getting Started with the Event Recorder in Business Central - CloudFronts

Getting Started with the Event Recorder in Business Central

When developing customizations or extensions in Microsoft Dynamics 365 Business Central, working with events is a best practice. Events help ensure your code is upgrade-safe and cleanly decoupled from the standard application code. However, one common challenge developers face is figuring out which events are triggered during certain actions in the system.

That’s where the Event Recorder comes in.

What Is the Event Recorder?

The Event Recorder is a built-in tool in Business Central that allows developers to monitor and log all published and subscribed events during a user session. Think of it as a “black box” recorder for event-driven development. It helps you identify:

  • Which events are raised during a specific action.
  • Which objects publish and subscribe to those events.
  • The order and frequency of event executions.

This tool is extremely helpful when you’re customizing functionality using event subscriptions (as per AL best practices) but aren’t sure which event to subscribe to.

Why Use the Event Recorder?

Traditionally, developers had to dig through AL code or documentation to find the right event to subscribe to. With the Event Recorder, this becomes faster and more efficient.

Key benefits include:

  • Save development time by quickly identifying the right events.
  • Improve code quality by avoiding trial-and-error or unnecessary custom code.
  • Reduce upgrade issues by sticking to event subscriptions instead of modifying base code.

How to Use the Event Recorder

Here’s a step-by-step guide:

Step 1: Open Event Recorder

  1. Search for “Event Recorder” in the Business Central search bar.
  2. Open the Event Recorder page.

Step 2: Start a New Recording

  • Click “Start” to begin a new recording session.
  • Perform the actions in Business Central that you want to monitor. For example, creating a new customer.

Step 3: Stop Recording

  • Once you’ve finished the activity, go back to the Event Recorder and click “Stop”.

Step 4: Review the Results

  • The tool will display a list of events that were triggered during the session.
  • You’ll see details such as:
    • Event Type (Trigger Event, Custom Event)
    • Object Type
    • Event Name
    • Calling Object Type
    • Calling Method

Best Practices

  • Use the Event Recorder in a sandbox environment to avoid cluttering logs in a production database.
  • Filter the event results to focus only on relevant events like OnBefore, OnAfter,  OnValidate or onInit triggers.
  • Copy the event signature from the recorder and paste it into your AL extension for quick subscription.

Sample Use Case

Suppose you’re trying to add custom logic every time a Sales Invoice is posted. You’re not sure which event gets triggered at that point. Using the Event Recorder:

  1. Start a session.
  2. Actual Process.
  3. Stop the recorder.
  4. Look through the results to find an event like OnAfterGetRecordEvent, etc.

Now, you can write a subscriber in your AL code like this:

[EventSubscriber(ObjectType::Page, Page::”Customer List”, ‘OnAfterGetRecordEvent’, ”, true, true)]

local procedure MyProcedure()

begin

// Your custom logic here

end;

Limitations

While powerful, the Event Recorder does have some limitations:

  • It doesn’t log every micro-event or internal process, only published events.
  • No deep call stack trace—only event-based logging.
  • May include a large number of events; filtering is key.

To conclude, Event Recorder is an indispensable tool for any AL developer working in Business Central. It simplifies the discovery of relevant events, helps maintain clean and upgrade-safe extensions, and boosts overall development efficiency.

Whether you’re new to AL or a seasoned developer, incorporating the Event Recorder into your workflow will save you time.

We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.


Share Story :

SEARCH BLOGS :

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange