Describe the issue
When exporting an XRechnung/ZUGFeRD document, the SELLER CONTACT group (BG-6) is populated via InsertSupplierContact, which sources the data from the Salesperson if one is assigned to the document, and otherwise falls back to Company Information. This fallback logic itself is correct and should not be changed.
The problem is that there is no validation at posting time. If the relevant source record (the assigned Salesperson, or Company Information when no Salesperson is set) is missing one or more of the required contact fields — Contact Person, Phone No., E-Mail — the document is posted and exported anyway. The resulting XML omits part or all of BG-6 and fails EN16931 / XRechnung validation, but the user only discovers this after the fact via an external validator or receiver rejection.
Relevant rules: BR-DE-2 (SELLER CONTACT group BG-6 must be present) and BR-DE-7 (seller contact email address BT-43 must be present).
Expected behavior
Business Central should raise an error during posting if the contact data required for BG-6 cannot be fully supplied from the applicable source:
- If a Salesperson is assigned to the document, the Salesperson record must have Name, Phone No., and E-Mail populated. If any is missing, posting should fail with an error naming the missing field.
- If no Salesperson is assigned, Company Information must have Contact Person, Phone No., and E-Mail populated. If any is missing, posting should fail with an error naming the missing field.
The fallback behaviour (Salesperson → Company Information) stays unchanged. The only change is failing fast at posting time so the user can fix the data before a non-compliant document is created.
Steps to reproduce
- Use Business Central for Germany with XRechnung or ZUGFeRD E-Document Service configured.
- Leave no Salesperson on the document (so Company Information is used as the contact source). Remove E-Mail (or Phone No.) from Company Information.
- Create and post a Sales Invoice.
- Actual result: Invoice posts successfully. Exported XML is missing BG-6 / BT-43 and fails validation (BR-DE-2 / BR-DE-7). No error shown at posting.
- Expected result: Posting is blocked with an error naming the missing field in Company Information.
- Repeat with a Salesperson assigned to the invoice whose record is missing Name, Phone No., or E-Mail.
- Actual result: Posts and exports an incomplete BG-6. No posting error.
- Expected result: Posting is blocked with an error naming the missing field on the Salesperson record.
Additional context
Would like to include @pri-kise and @marschmar on the topic
I will provide a fix for a bug
Describe the issue
When exporting an XRechnung/ZUGFeRD document, the SELLER CONTACT group (BG-6) is populated via
InsertSupplierContact, which sources the data from the Salesperson if one is assigned to the document, and otherwise falls back to Company Information. This fallback logic itself is correct and should not be changed.The problem is that there is no validation at posting time. If the relevant source record (the assigned Salesperson, or Company Information when no Salesperson is set) is missing one or more of the required contact fields — Contact Person, Phone No., E-Mail — the document is posted and exported anyway. The resulting XML omits part or all of BG-6 and fails EN16931 / XRechnung validation, but the user only discovers this after the fact via an external validator or receiver rejection.
Relevant rules: BR-DE-2 (SELLER CONTACT group BG-6 must be present) and BR-DE-7 (seller contact email address BT-43 must be present).
Expected behavior
Business Central should raise an error during posting if the contact data required for BG-6 cannot be fully supplied from the applicable source:
The fallback behaviour (Salesperson → Company Information) stays unchanged. The only change is failing fast at posting time so the user can fix the data before a non-compliant document is created.
Steps to reproduce
Additional context
Would like to include @pri-kise and @marschmar on the topic
I will provide a fix for a bug