Version: Available or changed with runtime version 1.0.
Specifies that the method is published as an integration type event.
[IntegrationEvent(IncludeSender: Boolean, GlobalVarAccess: Boolean [, Isolated: Boolean])]
Specifies whether global methods in the object that contains the event publisher method are exposed to event subscriber methods that subscribe to the event.
Specifies whether global variables in the object that contains the event publisher method are accessible to event subscriber methods that subscribe to the published event.
Specifies if event subscribers should be invoked in an isolated transaction.
Typing the shortcut
teventint will create the basic IntegrationEvent attribute syntax when using the AL Language extension for Microsoft Dynamics 365 Business Central in Visual Studio Code.
When you set the IncludeSender argument to true, the signature of event subscriber methods that subscribe to the published event automatically supports a
sender parameter for the published event object, which you must add manually (see the example).
Using GlobalVarAccess will throw a compiler warning, which will become an error in a future release. Instead use the event parameters or mark the page or table variables as protected. For more information, see Protected Variables.
When you set the GlobalVarAccess argument to true, event subscriber methods that subscribe to the event can call the global variable parameters in the object that declares the event publisher method. You must add variable parameters to the event subscriber method signatures manually and use a name and type that matches the variable declaration in the event publisher object (see the example).
For more information about the different event types, see Event Types.
For more information about isolated events, see Isolated Events.
This example publishes an integration type event by using the OnAddressLineChanged method. The method takes a single text data type parameter.
GlobalVarAccess arguments are set to true. This means that the signature of event subscriber method
senderparameter for event publishing codeunit
- A parameter for the global variable
myGlobalVardefined in the publishing codeunit
codeunit 50102 MyPublishingCodeunit
procedure OnAddressLineChangedEvent(line : Text)
codeunit 50103 MySubscribingCodeunit
[EventSubscriber(ObjectType::Codeunit, Codeunit::MyPublishingCodeunit, 'OnAddressLineChangedEvent', '', true, true)]
local procedure SubcribeToOnAddressLineChangedEvent(sender: Codeunit MyPublishingCodeunit; myGlobalVar: Integer)
// My subscriber code