microsoft / microsoft/BCApps

[Extensibility Request] Codeunit 11029 "IntrastatReportManagementDE" is internal, preventing event subscription

Open
#9,742 1 comment 0 reactions 1 assignee View on GitHub

@AndersLarsenMicrosoft is already working on this.

Since Aug 10, 2026.

Approved Team: Finance
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Describe the issue

This is a follow-up to https://github.com/microsoft/ALAppExtensions/issues/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 https://github.com/microsoft/ALAppExtensions/issues/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
  1. Create a new AL extension with a dependency on "Intrastat Report DE".

  2. Add an event subscriber:

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"IntrastatReportManagementDE",
    'OnBeforeCreateXMLNodeWithoutAttributesOnPartyIdPathOnBeforeSetXmlNodeValue',
    '', false, false)]
    local procedure OnBeforeSetPartyId(var NodeValue: Text)
    begin
    end;

  3. Compile the extension.

  4. 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
  • I will provide a fix for a bug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.