Redigera

Dela via


InternalEvent attribute

Version: Available or changed with runtime version 4.0.

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

Applies to

  • Method

Syntax

[InternalEvent(IncludeSender: Boolean [, Isolated: Boolean])]

Arguments

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

[Optional] Isolated
 Type: Boolean
Specifies if event subscribers should be invoked in an isolated transaction.

Snippet support

Typing the shortcut teventinternal will create the basic internal attribute syntax when using the AL Language extension for Microsoft Dynamics 365 Business Central in Visual Studio Code.

Remarks

For more information about isolated events, see Isolated Events.

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;
}

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