Integration events must not be declared in codeunits with Access set to Internal
An [IntegrationEvent] exists so that other extensions can subscribe to it. When the hosting codeunit has Access = Internal, external extensions cannot reference the codeunit — the integration point is dead on arrival. Subscribers in dependent apps fail to compile because the codeunit is inaccessible outside the defining module.
If the event is meant for external consumption, remove Access = Internal. If it is meant only for the same module (or those listed in internalsVisibleTo), declare it as an [InternalEvent] instead — the attribute makes the scope explicit.
Example
The following integration event is declared in an internal codeunit:
codeunit 50100 MyCodeunit
{
Access = Internal;
[IntegrationEvent(false, false)]
local procedure OnBeforeSomething() // Integration events must not be declared in codeunits with Access set to Internal [AC0012]
begin
end;
}If the event is intended only for the same module, change it to an [InternalEvent]:
codeunit 50100 MyCodeunit
{
Access = Internal;
[InternalEvent(false, false)]
local procedure OnBeforeSomething()
begin
end;
}If the event should remain available to all extensions, remove Access = Internal from the codeunit:
codeunit 50100 MyCodeunit
{
[IntegrationEvent(false, false)]
local procedure OnBeforeSomething()
begin
end;
}Code fix
Two automated fixes are available:
- Refactor from IntegrationEvent to InternalEvent — changes the
[IntegrationEvent]attribute to[InternalEvent], keepingAccess = Internalon the codeunit. - Remove property Access = Internal — removes the
Accessproperty from the codeunit, making the integration event accessible to all extensions.
See also
- Event Types on Microsoft Learn
- IntegrationEvent Attribute on Microsoft Learn
- InternalEvent Attribute on Microsoft Learn