Automate Invoice Copy as a PDF Attachment in e‑Invoices in D365FO

Microsoft Dynamics 365 Finance & Operations (D365FO) includes a built‑in capability—eInvoice attachment—that can automatically generate a PDF copy of the printable invoice and embed it inside the structured e‑invoice file (Peppol BIS, XRechnung, FatturaPA, or other ER‑driven formats). When enabled for selected customers, the PDF is rendered at posting time (from SSRS or Configurable Business Document layouts), stored as a document attachment on the posted journal record, and then included in the e‑invoice XML output produced by Electronic Reporting (ER).

This feature reduces custom integration effort with Access Points and consolidates invoice distribution flows across customer types—B2G, B2B, and B2C.

Why Use the eInvoice attachment Feature?

Many organizations operate in mixed customer landscapes: some customers (often business or public sector) are eligible for structured e‑invoices over networks such as Peppol, while others—especially private consumers (B2C)—still require a human‑readable invoice delivered by email or even print/post.

If you send all invoices to an Access Point (AP), that provider may:

  • Deliver structured XML to customers who support e‑invoicing.
  • Convert XML to PDF layout and send by email (or print/post) to recipients who do not support e‑invoicing.

Embedding a ready‑to‑send PDF invoice copy in the e‑invoice XML can lower AP conversion costs and avoid additional custom mappings on the Access Point side—especially in markets like Norway, where many APs offer XML‑to‑PDF fallback services for non‑Peppol customers.

Access Point Compatibility Is Critical

Before enabling this feature in production:

  1. Confirm with your Access Point that they accept e‑invoice payloads containing an embedded PDF copy.
  2. Verify whether the AP can extract that embedded PDF and use the customer email address (sent in the e‑invoice payload) to deliver the attachment by email.
  3. Agree on size limits and whether multiple attachments are allowed.

ER Configuration Consideration

If your downstream AP relies on the customer email address to forward the PDF, add a validation in your e‑invoice ER configuration to ensure the customer email is populated (fail or warn otherwise). Making this field effectively mandatory helps avoid unrouteable invoices.

How the Feature Works

High‑level flow:

  1. You enable eInvoice and eInvoice attachment on the Customer record.

  1. You configure Print management for the source document (Sales invoice, Free text invoice, Project invoice, Collection letter, etc.).

  1. At invoice posting, if Print invoice = Yes, D365FO renders the printable document to PDF (SSRS or CBD/EBD) and attaches it to the posted journal (e.g., CustInvoiceJour).

  1. Your e‑invoice ER format runs (immediately or in batch) and picks up the attachment for embedding (base64) within the generated e‑invoice XML.

  1. The outbound payload—XML + embedded PDF—is sent to your Access Point / integration layer.

You can review DynFOTech earlier blogs for detailed e‑invoicing setup guidance:

Prerequisites

Before testing the feature, confirm the following platform and functional prerequisites are in place:

  • Electronic Reporting (ER) framework configured and the relevant e‑invoice formats imported (Peppol BIS Billing 3.0 or local variant).
  • Document management enabled for the tables that will store the posted invoice attachments (see section below).

  • Security roles allow users to upload, view, and mark attachments as External.
  • Print management configured to render documents at posting.

  • PDF Converter configured (if using Configurable Business Documents) so the rendered output is PDF, not DOCX/XLSX.

  • Customer master data includes valid electronic address / email values if required by the receiving AP.

Note: Test end‑to‑end in a sandbox with an Access Point test endpoint to confirm that the embedded PDF is successfully extracted and deliverable.

Step 1 – Enable e‑Invoice + eInvoice attachment on Customers

  1. Navigate to Accounts receivable > Customers > All customers.
  2. Open the customer record.
  3. On the Invoice and delivery (or localization‑specific) FastTab, locate e‑invoicing fields.
  4. Set eInvoice = Yes.
  5. Set eInvoice attachment = Yes.
  6. Confirm email address and any required e‑address / electronic format identifiers (e.g., Peppol Participant ID, GLN, OVT, etc.) are populated.

[!IMPORTANT] Only enable eInvoice attachment for customers whose receiving channel or Access Point workflow supports XML containing embedded binary documents.

Step 2 – Configure Print Management Output

Correct print management is essential—this is what produces the PDF that becomes the embedded attachment.

If Using SSRS Reports

If your legal documents (Sales invoice, Free text invoice, etc.) use standard SSRS report designs, no special layout change is required. Ensure Print invoice = Yes when posting and that the destination is allowed to produce a file.

If Using Configurable Business Documents (CBD/EBD)

If you’ve replaced SSRS with Business Documents (Electronic Reporting‑designed layouts), you must ensure the design outputs PDF.

In Format designer:

  • Add a PDF Converter component at the Root of the output node.
  • Map the document so that the run‑time output is rendered to PDF regardless of the design authoring tool (Word/Excel template).

This guarantees the attachment added to the journal is a PDF (required by most Access Points), not DOCX or XLSX.

ER Destination Tip

You can also configure ER destinations so that PDF conversion happens in the ER pipeline rather than relying on the interactive “Convert to PDF” option during posting. This removes user dependency and supports batch automation.

Step 3 – Post with Print invoice = Yes

During posting (Sales order invoice, Free text invoice posting, Project invoice proposal posting, Collection letter update):

  1. Set Print invoice = Yes in the posting dialog.
  2. Post the document.

Behind the scenes, D365FO will:

  1. Post the document (journal created).
  2. Render the printable invoice layout to PDF.
  3. Attach the PDF to the posted journal table (CustInvoiceJour, ProjInvoiceJour, or CustCollectionLetterJour).
  4. Run the ER e‑invoice format (immediate or batch) that reads the journal record and, because the customer is flagged for eInvoice attachment, embeds the PDF as base64 in the XML.

Result: PDF Embedded in e‑Invoice XML

Open the generated e‑invoice file in XML view. You should see a structure similar to (Peppol BIS Billing 3.0 style illustration):

<cac:AdditionalDocumentReference>
    <cbc:ID>5637303583</cbc:ID>
    <cac:Attachment>
      <cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf" filename="FreeTextInvoice.Report.pdf">JVBERi0... (base64 content trimmed)
    </cbc:EmbeddedDocumentBinaryObject>
  </cac:Attachment>
</cac:AdditionalDocumentReference>

Exact element paths vary by e‑invoice format (Peppol vs. FatturaPA vs. custom), but the principle is the same: the rendered PDF becomes a base64‑encoded binary attachment within the e‑invoice message.

What If Print invoice = No? (Manual Attach & Re‑send)

If you post with Print invoice = No:

  • No PDF is rendered.
  • No automatic embedded attachment.
  • No e‑invoice is generated (in most standard ER e‑invoice flows that rely on print generation).

Recovery option:

  1. Open the posted invoice journal (e.g., Accounts receivable > Inquiries and reports > Invoices > Invoice journal).
  2. Select the journal line and click View > Original view (or open the document menu depending on form).

  1. This function will work based on ER destinations setup and then attached PDF copy of invoice as an attachment to the journal.
  1. Re‑run the e‑invoice ER process to regenerate the XML; the PDF attachment will now be included.

This same recovery applies to ProjInvoiceJour and CustCollectionLetterJour.

Supported Documents & Tables

Document TypeOrigin / Module PathPosted Journal TableAuto PDF Attach When Print invoice = Yes?
Sales invoiceAccounts receivable > Inquiries and reports > Invoices > Invoice journalCustInvoiceJour✔ Yes
Free text invoiceAccounts receivable > Inquiries and reports > Invoices > Invoice journalCustInvoiceJour✔ Yes
Project invoiceProject management & accounting > Project invoices > Project invoicesProjInvoiceJour✔ Yes
Collection letterCredit and collections > Collection letters > Review and process collection lettersCustCollectionLetterJour✔ Yes

[!NOTE] Attachments on open source documents typically flow forward to the posted journal during posting—confirm in your environment and customization layer.

Access, Security & Document Management Setup

Attachments depend on D365FO Document management. Make sure it’s active for the posted journal tables that will store generated PDFs and any supporting files.

  1. Go to Organization administration > Document management > Active document tables.
  2. Enable document handling if not already enabled.
  3. Add/Select:
    • CustInvoiceJour
    • ProjInvoiceJour
    • CustCollectionLetterJour
    • (Optional) other tables if you plan to embed additional docs.
  4. Mark as Always enabled where appropriate.

Security

Ensure users who post invoices or troubleshoot attachments have roles including:

  • Maintain document attachments
  • View document attachments

Without permission, the paperclip icon may not include “+New” and PDFs won’t be visible/attachable.

Troubleshooting & Tips

SymptomPossible CauseResolution
No PDF embedded in XMLPrint invoice = No at posting
Customer card is not enabled with einvoice attachment
Re-print the journal to populated the attachment.
Embedded file not PDFCBD/EBD layout missing PDF Converter rootEdit ER format; add PDF Converter; redeploy.
Attachment missing in journalDocument management inactive for that tableActivate table in Document management > Active document tables.
Access Point rejects payloadUnsupported attachment type/sizeConfirm AP limits; compress or reduce PDF size.
Generic PDF filenameCurrent standard naming behaviorVote for enhancement (see Idea below).

Known Limitations & Network Considerations

  • Peppol BIS guidance: Attachments are allowed for supporting documents; invoice copies are not required and networks may impose size limits. Validate your use case with your AP and your local tax/industry guidance.
  • Attachment Size: Large PDF designs (many pages, embedded graphics) can cause rejection; some networks cap payloads (e.g., 10–100 MB). Confirm limits.
  • Performance: Rendering PDFs at posting adds processing time; consider batch posting if volume is high.

Summary Checklist

Embedding attachments in e‑invoices within D365FO is efficient, robust, and standard‑compliant—as long as you:

  • Use supported formats. (Most scenarios require PDF.)
  • Respect each standard’s limitations (size, count, invoice‑copy rules).
  • Add attachments before posting or e‑invoice generation.
  • Ensure Document management is enabled and users have access to the required attachment (Active document) tables (CustInvoiceJour, ProjInvoiceJour, CustCollectionLetterJour, etc.).
  • Enable eInvoice attachment on the customer when needed.
  • Configure Print management & PDF Converter (CBD/EBD) to guarantee PDF output.
  • Select Print invoice = Yes when posting to trigger PDF creation and embedding.
  • Consider merging multiple files into a single PDF for clarity and network efficiency.

By following these guidelines, you can create richer, more compliant e‑invoices that satisfy both tax authorities and your customers—and automate large parts of your invoicing process effectively.

Additional Resources

Dynfotech Blog Series

Microsoft Learn (sample areas to review)

Idea: Improve PDF filename for generated invoice copy
Vote or comment: https://experience.dynamics.com/ideas/idea/?ideaid=3235be56-512b-f011-9d48-7c1e52960760

3 Comments Add yours

  1. Robise's avatar Robise says:

    Hi Alireza,

    Very interesting article, thank you!

    We’re facing an issue regarding the document type that seems to be defaulted to “File” when D365 F&O automatically attach the invoice to the invoice journal. Do you know if there is a possibility to choose the default document type that D365 F&O will use to attach the PDF document ?

    We are using the PDF converter component in our ER Format.

    Many thanks for your help,

    David

    Like

    1. Alireza Eshaghzadeh's avatar Alireza Eshaghzadeh says:

      Hi David,
      Thanks for the feedback!
      It is recommended to use File as the document type.

      If you need to review or adjust the configuration, you can navigate to:

      Organization administration > Document management parameters > Default document types
      – to check the standard document type.

      Workspaces / Immersive home > Electronic reporting > Electronic reporting parameters > Attachment
      – to adjust the Job archive settings.

      Like

Leave a reply to Robise Cancel reply