Skip to main content

Document

The Document feature gives your flows a way to store, manage, and preview files directly inside Business Central. Documents are commonly used for email attachments, generated reports, imported data files, or any other binary content that a flow needs to handle.

Typical use cases include:

  • Storing a PDF report generated by a flow step.
  • Attaching a file received from an HTTP request to a Business Central record.
  • Importing CSV or XML data files for further processing.
  • Keeping HTML templates for automated emails.

Data structure

Each document stores the following information:

FieldTypeDescription
IDIntegerUnique identifier, auto-generated.
NameTextThe file name, including extension.
Content TypeTextThe MIME type of the file (e.g. application/pdf, text/html).
LengthIntegerFile size in bytes, calculated on import.
DataMediaThe actual file content, stored using BC's Media type.

The Media type ensures cloud-compatible storage that works seamlessly with Business Central online and on-premises environments.

Pages

Document List

The Document List page shows all stored documents with their name, content type, and size. Use it to browse, search, and manage your documents.

  • Import action: Creates a new document record and opens the file picker to upload a file.
  • Preview FactBox: The right-hand side shows a live preview of the selected document.

Document Card

The Document Card page provides a detailed view of a single document, including a large preview area.

  • Import action: Upload or replace the file for this document.
  • Export action: Download the document file to your local machine.

Preview

The preview adapts to the content type of the document:

Content TypePreview
PDF (application/pdf)Embedded viewer using an iframe.
HTML (text/html)Rendered HTML content.
Images (image/png, image/jpeg, etc.)Inline image display.
Text-based (text/plain, application/json, application/xml, etc.)Preformatted text with monospace font.
OtherFile metadata (name, type, size) with a note that preview is not available.

The preview is available both on the Document Card and as a FactBox on the Document List.

Working with documents in flows

Documents are designed to be created and consumed by flow steps. A typical pattern looks like this:

  1. A trigger or action produces file content (e.g. an HTTP response body, a generated report).
  2. The flow creates a Document record and imports the content.
  3. Later steps can read the document, attach it to an email, or export it.

Best practices

  • Set the content type explicitly: Always provide the correct MIME type so that previews and downstream processing work correctly.
  • Use meaningful names: Include the file extension in the name (e.g. invoice-2024-001.pdf) to make documents easy to identify.
  • Clean up when done: If documents are only needed temporarily during flow execution, consider deleting them after use to keep storage tidy.