[Extensibility Request] Support for additional ZUGFeRD document type codes in Codeunit 13919
Why do you need this change?
Description In Codeunit 13919 "Import ZUGFeRD Document", the current implementation (around line 56) only accounts for standard Invoices and Credit Memos.
Our customers in the construction industry regularly receive electronic invoices that use a much broader range of document types (e.g., partial invoices, final settlements, or prepayment requests). According to the ZUGFeRD 2.4 / Factur-X 1.0.8 specification, there are over 50 valid document type codes.
Since the current implementation is hardcoded, these documents cannot be processed at all. This creates a significant gap in the standard European electronic invoicing functionality for specialized industries.
Business Value Allowing the processing of all ZUGFeRD-compliant document types ensures that Business Central remains compliant with modern electronic invoicing standards across all industries, especially construction and public procurement, where specialized codes are mandatory.
Additional Context Object: Codeunit 13919 "Import ZUGFeRD Document" Version Reference: ZUGFeRD 2.4 / Factur-X 1.0.8 Current Limitation: Documents with codes other than '380', '384', '751', '877' or '381', '261' result in a failure to import, making the feature unusable for certain business sectors.
Describe the request
Proposed Change We request that the hardcoded document type mapping be opened up for extensibility. Specifically:
Refactor the mapping logic: Instead of a fixed assignment, provide a way to map the ~50 available ZUGFeRD codes to the supported Business Central document types.
Add an Integration Event: This would allow partners to handle specific industry codes (e.g., mapping a "Partial Invoice" to a standard "Invoice") without having to rewrite the entire import routine.
Internal work item: AB#620280
Would an event like this suffice to let you map the codes to one of the supported codes? If so, what other parameters do you need?
...
DocumentType := GetDocumentType(TempXMLBuffer, DocumentNamespace);
OnParseBasicInfoOnBeforeDocumentTypeCheck(DocumentType, ...); // EVENT
case UpperCase(DocumentType) of
...
We would prefer a little more of it in order to handle it more precisely.
OnParseBasicInfoOnBeforeDocumentTypeCheck(DocumentType, EDocument, TempXMLBuffer, DocumentNamespace,CrossIndustryInvoiceLbl,PdfInStream, IsHandled); // EVENT
if IsHandled then
exit;
Does it work for you if the event is added in the else case?
case UpperCase(DocumentType) of
'380', '384', '751', '877':
if DocumentNamespace <> '' then
ParseInvoiceBasicInfo(EDocument, TempXMLBuffer, StrSubstNo(DocumentElementLbl, DocumentNamespace, CrossIndustryInvoiceLbl), PdfInStream)
else
ParseInvoiceBasicInfo(EDocument, TempXMLBuffer, CrossIndustryInvoiceLbl, PdfInStream);
'381', '261':
if DocumentNamespace <> '' then
ParseCreditMemoBasicInfo(EDocument, TempXMLBuffer, StrSubstNo(DocumentElementLbl, DocumentNamespace, CrossIndustryInvoiceLbl), PdfInStream)
else
ParseCreditMemoBasicInfo(EDocument, TempXMLBuffer, CrossIndustryInvoiceLbl, PdfInStream)
else begin
OnParseBasicInfoDocumentTypeCheckElseCase(DocumentType, EDocument, TempXMLBuffer, DocumentNamespace,CrossIndustryInvoiceLbl,PdfInStream, IsHandled); // EVENT
if not IsHandled then
FeatureTelemetry.LogUsage('0000EXE', FeatureNameTok, StrSubstNo(UnsupportedDocumentTypeErr, DocumentType));
Error(UnsupportedDocumentTypeErr, DocumentType);
end;
I would prefere a subscriber before the case, like the BC default setups "OnBefore / On After"
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Build ID: 47259.