---
id: change/bcapps/9642
type: change
title: "#9642 [Bug]: E-Documents for Germany - FindEDocumentService always selects last matching service, ignoring which service triggered the export"
summary: E-Document exports for Germany now use the service that triggered the export instead of always selecting the last matching service, ensuring correct settings like PDF embedding are applied.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit export xrechnung document
  - codeunit xrechnung format
  - codeunit export zugferd document
  - reportextension posted sales cr.memo
  - reportextension posted sales invoice
  - reportextension posted service cr. memo
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:03:13.688Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 0b91a89d90c4803d17db5e2f1fe6178eefde6109
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9642
    title: "microsoft/BCApps#9642: [Bug]: E-Documents for Germany - FindEDocumentService always selects last matching service, ignoring which service triggered the export"
    date: "2026-09-29"
    commit: 0b91a89d90c4803d17db5e2f1fe6178eefde6109
    t: null
    quote: The triggering service is now handed to the export instead
links:
  learn: []
  objects:
    - object/codeunit/13916-de
    - object/codeunit/13914-de
    - object/codeunit/13917-de
    - object/reportextension/13919-de
    - object/reportextension/13918-de
    - object/reportextension/13921-de
    - object/reportextension/13920-de
    - object/codeunit/11042-de
    - object/codeunit/13920-de
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9642
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9642
kind: pr
base_branch: main
major: "30"
merged_at: "2026-09-29T22:23:02Z"
author: miljance
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - From Fork
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 12
  additions: 847
  deletions: 1
  al: 9
apps:
  - EDocumentDE
objects_touched:
  - key: codeunit/13916
    page: codeunit/13916-de
    type: codeunit
    id: 13916
    name: Export XRechnung Document
    app: EDocumentDE
    status: modified
  - key: codeunit/13914
    page: codeunit/13914-de
    type: codeunit
    id: 13914
    name: XRechnung Format
    app: EDocumentDE
    status: modified
  - key: codeunit/13917
    page: codeunit/13917-de
    type: codeunit
    id: 13917
    name: Export ZUGFeRD Document
    app: EDocumentDE
    status: modified
  - key: reportextension/13919
    page: reportextension/13919-de
    type: reportextension
    id: 13919
    name: Posted Sales Cr.Memo
    app: EDocumentDE
    status: modified
  - key: reportextension/13918
    page: reportextension/13918-de
    type: reportextension
    id: 13918
    name: Posted Sales Invoice
    app: EDocumentDE
    status: modified
  - key: reportextension/13921
    page: reportextension/13921-de
    type: reportextension
    id: 13921
    name: Posted Service Cr. Memo
    app: EDocumentDE
    status: modified
  - key: reportextension/13920
    page: reportextension/13920-de
    type: reportextension
    id: 13920
    name: Posted Service Invoice
    app: EDocumentDE
    status: modified
  - key: codeunit/11042
    page: codeunit/11042-de
    type: codeunit
    id: 11042
    name: ZUGFeRD Export Context
    app: EDocumentDE
    status: added
  - key: codeunit/13920
    page: codeunit/13920-de
    type: codeunit
    id: 13920
    name: ZUGFeRD Format
    app: EDocumentDE
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues:
  - 8414
work_items:
  - 651618
systems:
  - integration
quote: The triggering service is now handed to the export instead
joined_against:
  major: "30"
  commit: a4406cfa9e57437fedc49c53c327a199a854491e
---

# #9642 [Bug]: E-Documents for Germany - FindEDocumentService always selects last matching service, ignoring which service triggered the export

> E-Document exports for Germany now use the service that triggered the export instead of always selecting the last matching service, ensuring correct settings like PDF embedding are applied.

[Pull request](https://github.com/microsoft/BCApps/pull/9642) · merged into `main` (BC30) on 2026-09-29 by miljance (community contribution) · 12 files (+847 -1), 9 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- XRechnung format passes the triggering service to Export XRechnung Document through SetEDocumentService
- ZUGFeRD uses a new ZUGFeRD Export Context codeunit to carry the service from format into report extensions
- FindEDocumentService and OnAfterFindEDocumentService are deprecated but kept working until CLEAN29 for backward compatibility
- Tests verify both the new path and legacy fallback work correctly
- Context codeunit is public so partners can use it in customized report extensions
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 13916 "Export XRechnung Document"](../../objects/codeunit/13916-de.md), EDocumentDE (DE layer): modified
- [Codeunit 13914 "XRechnung Format"](../../objects/codeunit/13914-de.md), EDocumentDE (DE layer): modified
- [Codeunit 13917 "Export ZUGFeRD Document"](../../objects/codeunit/13917-de.md), EDocumentDE (DE layer): modified
- [Report extension 13919 "Posted Sales Cr.Memo"](../../objects/reportextension/13919-de.md), EDocumentDE (DE layer): modified
- [Report extension 13918 "Posted Sales Invoice"](../../objects/reportextension/13918-de.md), EDocumentDE (DE layer): modified
- [Report extension 13921 "Posted Service Cr. Memo"](../../objects/reportextension/13921-de.md), EDocumentDE (DE layer): modified
- [Report extension 13920 "Posted Service Invoice"](../../objects/reportextension/13920-de.md), EDocumentDE (DE layer): modified
- [Codeunit 11042 "ZUGFeRD Export Context"](../../objects/codeunit/11042-de.md), EDocumentDE (DE layer): added
- [Codeunit 13920 "ZUGFeRD Format"](../../objects/codeunit/13920-de.md), EDocumentDE (DE layer): modified

## Context

- Fixes: [#8414 [Bug]: E-Documents for Germany - FindEDocumentService always selects last matching service, ignoring which service triggered the export](https://github.com/microsoft/BCApps/issues/8414) (open)
- Work items: AB#651618
- Labels: ADO: Sync, From Fork, Team: Finance
- Systems: integration
- From the description: "The triggering service is now handed to the export instead"

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
