web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Better understanding of Event Subscribers, Integration Events and IsHandled flags

(0) ShareShare
ReportReport
Posted on by 423

Hi,

I'd like to have a better understanding of event subscribers, integration events and IsHandled flag. Let's say there is a procedure in a base codeunit that looks like:

local procedure Procedure1()

    var
        IsHandled: Boolean;
    begin
        IsHandled := false;
        FirstIntegrationEvent(IsHandled);
        if IsHandled then
            exit;

        code
        SecondIntegrationEvent();
    end;
In my own codeunit, I create an event subscriber to the FirstIntegrationEvent, where I modify the code section and set IsHandled to true so the base code doesn't get executed
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Codeunit", 'FirstIntegrationEvent', '', true, true)]
    local procedure "Codeunit1_FirstIntegrationEvent"
    (
        var IsHandled: Boolean
    )
begin
        baseCodeModified
        //SecondIntegrationEvent(var1); //This line is removed as I can't called the 2nd integration event from my event subscriber
        IsHandled := true;
end;
I'm assuming, since I'm using IsHandled, that the 2nd integration event will never be called, correct? I know I could add some code to handle it if I need to call that 2nd event trigger. But what if another app/extension is calling that 2nd integration event. That part of the code from that extension will just be ignored?
It makes no sense to me, what am I missing
  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

  • Suggested answer
    Greg Enns Profile Picture
    1,122 on at

    You are correct. If you set IsHandled = TRUE, then the SecondIntegrationEvent will not be called. This is the difficulty and danger of customization.

    Your options are:

    A. You are responsible for making sure everything that needs to happen happens in your EventSubscriber.

    B. Handle ALL code in your Subscriber procedure.

    C. Subscribe to a different IntegrationEvent

    As you said, option B is difficult because you don't know who/what else might be subscribed to the SecondIntegrationEvent.

    Option C is always worth exploring. Perhaps you can find an IntegrationEvent later in the process? You might have to "Undo" some of what was done after FirstIntegrationEvent but that can still be the better option at times. Keep in mind that you can ask Microsoft to add IntegrationEvents (aka. "Event Publisher") anywhere in the system. You can do that here: AL Event Requests

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 755 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 413 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 387 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans