Describe the issue
This is a follow-up to microsoft/ALAppExtensions#29274. Thank you for implementing the requested event.
Codeunit 11029 "IntrastatReportManagementDE" (Intrastat Report DE) raises the
integration event OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue,
but the codeunit itself is declared as Access = Internal. As a result the event
cannot be subscribed to from an external extension, so the publisher has no effect
outside the app.
Background (unchanged from microsoft/ALAppExtensions#29274): In Germany, companies belonging to a
"Umsatzsteuerorganschaft" (VAT group) must file their Intrastat declaration under
the VAT registration number of the VAT group, while their own VAT registration
number is used on sales documents. Codeunit 11029 "IntrastatReportManagementDE"
writes the company's own VAT registration number into the XML party id node, so
the exported value has to be overridable.
The event OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue
was added to address this. However, it cannot be used from a customer or partner
extension, because codeunit 11029 "IntrastatReportManagementDE" is declared as
Access = Internal.
Proposed fix:
A) Change Access of codeunit 11029 to Public.
B) Move the publisher into a small dedicated public codeunit that only exposes the
integration event, keeping codeunit 11029 internal.
Expected behavior
An external extension should be able to subscribe to
OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue and
replace the registration number that the standard code writes at this position,
without the AL compiler rejecting the subscriber because of the protection level
of the publishing codeunit.
Steps to reproduce
-
Create a new AL extension with a dependency on "Intrastat Report DE".
-
Add an event subscriber:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"IntrastatReportManagementDE",
'OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue',
'', false, false)]
local procedure OnBeforeSetPartyId(var NodeValue: Text)
begin
end;
-
Compile the extension.
-
Compilation fails: <error AL0161: 'Codeunit Microsoft.Inventory.Intrastat.IntrastatReportManagementDE' is inaccessible due to its protection level>
Additional context
No response
I will provide a fix for a bug
Describe the issue
This is a follow-up to microsoft/ALAppExtensions#29274. Thank you for implementing the requested event.
Codeunit 11029 "IntrastatReportManagementDE" (Intrastat Report DE) raises the
integration event OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue,
but the codeunit itself is declared as Access = Internal. As a result the event
cannot be subscribed to from an external extension, so the publisher has no effect
outside the app.
Background (unchanged from microsoft/ALAppExtensions#29274): In Germany, companies belonging to a
"Umsatzsteuerorganschaft" (VAT group) must file their Intrastat declaration under
the VAT registration number of the VAT group, while their own VAT registration
number is used on sales documents. Codeunit 11029 "IntrastatReportManagementDE"
writes the company's own VAT registration number into the XML party id node, so
the exported value has to be overridable.
The event OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue
was added to address this. However, it cannot be used from a customer or partner
extension, because codeunit 11029 "IntrastatReportManagementDE" is declared as
Access = Internal.
Proposed fix:
A) Change Access of codeunit 11029 to Public.
B) Move the publisher into a small dedicated public codeunit that only exposes the
integration event, keeping codeunit 11029 internal.
Expected behavior
An external extension should be able to subscribe to
OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue and
replace the registration number that the standard code writes at this position,
without the AL compiler rejecting the subscriber because of the protection level
of the publishing codeunit.
Steps to reproduce
Create a new AL extension with a dependency on "Intrastat Report DE".
Add an event subscriber:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"IntrastatReportManagementDE",
'OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue',
'', false, false)]
local procedure OnBeforeSetPartyId(var NodeValue: Text)
begin
end;
Compile the extension.
Compilation fails: <error AL0161: 'Codeunit Microsoft.Inventory.Intrastat.IntrastatReportManagementDE' is inaccessible due to its protection level>
Additional context
No response
I will provide a fix for a bug