Document Export

Prev Next

Feature Overview

Document Export is Commerce Manager's mechanism for pushing structured snapshots of Business Central sales, purchase, and shipment documents to external systems. Where Sales Order Import handles inbound order traffic, Document Export handles the outbound flow — allowing Business Central to proactively send document data to a customer portal, an e-commerce platform, a logistics partner, or any other connected system that needs to stay in sync with order status, invoice information, or shipment confirmations.

A Document Export configuration defines a staged snapshot of a specific document type — sales orders, posted sales invoices, posted sales credit memos, purchase orders, posted purchase receipts, or posted sales shipments. When the export is triggered, Commerce Manager collects the document headers and lines that match the configured selection criteria and writes them into a set of staging tables: Doc Exp Sales Header/Line, Doc Exp Purchase Header/Line, or Doc Exp Sales Shipment Header/Line. These staging records can then be enriched with Master Data Selection values from the Master Data Information app, appending up to ten additional text fields per header and per line before the payload is sent. The staged data is then exported via webhook using the Data Contract Manager infrastructure.

The staging approach decouples the export timing from document creation — you can recalculate and re-export the staged data at any time without affecting the original BC documents. Actions on the staged header and lines allow you to refresh the selection (adding new documents or removing ones that no longer qualify), update the document fields, and recalculate master data enrichment, all from the document export page.

Key fact Detail
Supported document types Sales documents (orders, invoices, credit memos), Purchase documents (orders, receipts), Posted Sales Shipments
Staging tables Doc Exp Sales Header/Line, Doc Exp Purchase Header/Line, Doc Exp Sales Shipment Header/Line
Master data enrichment Optional; requires Master Data Information app; configured via Master Data Selection on the export setup
Export mechanism Webhook via Data Contract Manager
Free text fields 5 free text fields on headers and lines for arbitrary channel metadata
Master data text fields 10 master data text fields on headers and lines for MDI-sourced enrichment

Getting Started

  1. Ensure a webhook is configured in Data Contract Manager for the document type you want to export (e.g. a webhook that accepts sales order header and line data).
  2. Search for the relevant Document Export setup page for your document type (e.g. Doc. Exp. Sales Headers for sales documents).
  3. Create a new Document Export entry. Enter a code and configure the selection criteria that determine which documents are included.
  4. If you want Master Data Information values to travel with each document, set the Master Data Header Selection and/or Master Data Line Selection fields to the relevant Master Data Selection codes.
  5. Use the Add and Remove Headers action to populate the staging table with all documents matching your criteria.
  6. Use the Add and Remove Lines action to populate the document lines for all staged headers.
  7. If Master Data Selection is configured, use the Update Master Data action to enrich the staged records with MDI values.
  8. Configure the export webhook code and trigger the export. The staged data — headers, lines, and any master data enrichment — is sent to the external system.

Related Features

Document Export is the outbound counterpart to Sales Order Import — together they form a complete bidirectional integration loop between Business Central and external channels. When the Master Data Information app is installed, Document Export can be enriched using Master Data Selections, which define exactly which MDI information codes to pull and which columns to populate on the staged records. The feature relies on Data Contract Manager Core (a required dependency of Commerce Manager Core) for webhook infrastructure and batch processing.


User Stories

US-01: Stage and export sales order documents to an external system

As a Sales Order Processor
I want to push a snapshot of sales order headers and lines to an external system
So that the external system stays in sync with current order status and quantities without polling Business Central directly

Setup:

  1. Open Doc. Exp. Sales Headers and create or open the relevant export configuration.
  2. Use Add and Remove Headers to populate the staging table with sales orders matching your selection criteria.
  3. Use Add and Remove Lines to populate the corresponding sales order lines.
  4. Review the staged headers and lines on the sub-pages.
  5. Trigger the export webhook. The staged data is sent to the external system.
US-02: Export posted sales shipments to a logistics partner

As a Warehouse Manager
I want to push posted sales shipment headers and lines to a logistics or 3PL system
So that the external system receives confirmed dispatch information without manual data entry or file transfers

Setup:

  1. Open Doc. Exp. Sales Shipment Headers and create an export configuration targeting posted shipments.
  2. Use Add and Remove Headers to collect the relevant posted shipment headers into the staging table.
  3. Use Add and Remove Lines to collect the shipment lines.
  4. Configure and trigger the export webhook to push the staged shipment data.
US-03: Export purchase order data to a vendor portal

As a Purchasing Agent
I want to push purchase order headers and lines to a vendor portal
So that vendors can view their open orders without requiring direct access to Business Central

Setup:

  1. Open Doc. Exp. Purchase Headers and create an export configuration.
  2. Use Add and Remove Headers to stage the relevant purchase order headers.
  3. Use Add and Remove Lines to add the corresponding purchase lines.
  4. Trigger the export. The purchase data is sent to the vendor portal via the configured webhook.
US-04: Enrich document export with Master Data Information values

As a IT Manager
I want to attach MDI-sourced text values (e.g. customer classification codes, product descriptions) to each staged document header and line
So that the external system receives the enriched data it needs in a single export payload without making separate API calls

Setup:

  1. Ensure the Master Data Information app is installed and enabled.
  2. Open the Document Export configuration (e.g. for sales orders).
  3. Set the Master Data Header Selection to the MDI selection code that defines which information codes to pull for document headers.
  4. Set the Master Data Line Selection to the MDI selection code for document lines.
  5. After staging headers and lines, use the Update Master Data action. Commerce Manager reads MDI values for each staged record and writes them to the Master Data Text 1–10 fields.
  6. These fields are included in the export payload.

Note: Each Master Data Selection line can be configured to write the MDI value either into a dedicated Master Data Text column (for a separate sub-table) or directly into one of the 10 Master Data Text fields on the staged header or line record. The Add to Item Group Column option on the Master Data Selection line controls this.

US-05: Refresh the staged document set without re-exporting everything

As a Sales Order Processor
I want to update the staged document set — adding new orders and removing ones that no longer qualify — without having to rebuild the entire export from scratch
So that the export stays current when new orders are created or existing orders are cancelled or shipped

Setup:

  1. Open the Document Export configuration.
  2. Choose Add and Remove Headers (available as an action on the staged header page via the trigger field). Commerce Manager compares the current document selection against the staged headers and inserts new headers and removes headers that no longer match.
  3. Choose Add and Remove Lines to synchronise lines in the same way.
  4. Re-trigger the export webhook to push the refreshed dataset.
US-06: Use free text fields to attach channel metadata to exported documents

As a IT Manager
I want to attach custom text values to the staged document records
So that the export payload carries routing or classification metadata that the external system needs to process the documents correctly

Setup:

  1. Open the staged header or line record in the Document Export.
  2. The Free Text 1–5 fields on both header and line staging records are available for any custom value.
  3. These fields can be populated manually or programmatically (e.g. via a custom extension that subscribes to the export events) and are included in the webhook payload.

Field Reference

Field Where to find it What it does Default
Header Table Name Doc Exp staging pages Internal identifier for the document type being exported
Document Export Code Doc Exp staging pages The export configuration code
Master Data Header Selection Document Export setup MDI selection code used to enrich staged document headers Blank
Master Data Line Selection Document Export setup MDI selection code used to enrich staged document lines Blank
Sell-to Customer No. Doc Exp Sales Header Customer number from the source sales document
Sell-to Customer Name Doc Exp Sales Header Customer name from the source sales document
Bill-to Customer No. Doc Exp Sales Header Invoice customer number from the source sales document
Free Text 1–5 Doc Exp Header and Line Arbitrary metadata fields for channel routing or classification Blank
Master Data Text 1–10 Doc Exp Header and Line MDI-sourced text values populated by the Update Master Data action Blank
Item No. Doc Exp Sales Line Item number on the document line
GTIN Doc Exp Sales Line GTIN of the item
Quantity Doc Exp Sales Line Ordered quantity
Unit Price Doc Exp Sales Line Unit price at the time of staging
Document Date Doc Exp Sales Line Document date from the source document