Skip to content

[Bug]: XRechnung – Invalid XML Generated When Customer is missing data. #29264

@miljance

Description

@miljance

Describe the issue

When a Sales Invoice is posted for a customer record that is missing mandatory master data (e.g., address fields, email), the generated xRechnung XML file is invalid.
The XML export does not enforce validation of required customer fields before posting, which results in missing elements in the XML.
As a consequence, the file fails validation in the official xRechnung validator with multiple errors related to incomplete customer address information.

Expected behavior

  • A posted Sales Invoice should always produce a valid xRechnung XML file.
  • If mandatory customer data is missing, the system should prevent posting until the required information is completed.
  • Users should not discover XML errors only after posting; the export must remain compliant with posted document values.

Steps to reproduce

Repro

  1. Use Business Central for Germany.
  2. Enable E-Document Service for XRechnung.
  3. In setup:
    • Set Buyer Reference Mandatory = Yes
    • Set Buyer Reference = Your Reference
  4. Configure a Workflow for XRechnung (per docs).
  5. Configure a Document Sending Profile for XRechnung (per docs) and mark it as default.
  6. Create a new domestic customer without using customer templates.
  7. Enter only a name for the customer (no address, no email).
  8. Assign posting groups: Gen. Bus. Posting Group, VAT Bus. Posting Group, and Customer Posting Group (e.g., INLAND).
  9. Create a new Sales Invoice for this customer and enter any value in Your Reference.
  10. Add a Sales Line with any value (e.g., 4.000,00 EUR).
  11. Post the Sales Invoice.
  12. Open the Posted Sales Invoice.
  13. Navigate to Related → E-Document → Open E-Document.
  14. From E-Document Logs, export the XML file.
  15. Upload the file to the xRechnung Validator.
  16. Observe the errors: validator reports multiple missing address fields.
Image

Additional context

Fixes
AB#609594

I will provide a fix for a bug

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaapprovedThe issue is approved

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions