InternalEvent Attribute

APPLIES TO: Business Central 2019 release wave 2 and later

Specifies that the method is published as an internal event. It can only be subscribed to from within the same module.

Snippet support

Typing the shortcut teventinternal will create the basic internal attribute syntax when using the AL Language extension in Visual Studio Code.

Syntax

[InternalEvent(IncludeSender : Boolean)]

Arguments

IncludeSender
Type: Boolean

Specifies that the firing instance of the object is available as a parameter to subscribers of that event.

Example

Setting the attribute on a method. Each method must be marked with [InternalEvent].

codeunit 50131 MyInternalCodeunit
{
    Access = Internal;

    [InternalEvent(true)]
    procedure MyEvent()
    begin

    end;
}

codeunit 50132 MySubscriber
{
    [EventSubscriber(ObjectType::Codeunit, 50131, 'MyEvent', '', false, false)]
    procedure MySubscriber(sender: Codeunit MyInternalCodeunit)
    begin

    end;
}

See Also

AL Method Reference
Events in AL
Publishing Events
Raising Events
Subscribing to Events
Method Attributes