# Building a Document Routing Agent for Dynamics 365: Classify, Match, Attach and Route

> Source: https://netray.co/erp-ai/dynamics-365-document-routing-agent
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: AI for ERP

## Short answer

A Dynamics 365 document routing agent reads inbound documents such as invoices, POs, certificates and drawings, classifies them, matches each to the right ERP record, attaches it and routes it to the right person or queue. It can be built with Copilot Studio and Power Automate, or as a private agent when documents are sensitive.

## Kind

use-case

## Erp Family

microsoft

## Erp Products

- Dynamics 365 Finance and Operations
- Dynamics 365 Business Central
- Microsoft Copilot Studio
- SharePoint

## Industries

- Manufacturing
- Aerospace
- Distribution

## Region

Global

## Persona

ERP Manager

## Eyebrow

D365 document routing agent

## Intro

Every manufacturer has a shared mailbox that nobody wants to own. Vendor invoices, customer POs, order acknowledgements, packing lists, certificates of conformance, first article reports and revised drawings arrive in the same stream. Someone opens each one, works out what it is, finds the related purchase order or sales order in Dynamics, attaches it and forwards it. The work is simple, constant and error-prone.

A document routing agent automates that triage. It classifies the document, extracts the references that tie it to ERP records, looks those records up, attaches the document in Dynamics and routes it to the right queue with a short note. Where it is unsure, it says so and hands over to a person.

Microsoft provides building blocks: AI Builder document models, Copilot Studio agents, Power Automate flows, SharePoint and Dataverse queues. Business Central has e-document features for structured invoices. What it does not provide is a one-size routing agent for your document mix, your reference conventions and your queues. That is a design job, and the design decisions matter more than the model.

This page lays out the design: document classes, matching logic, ERP attachment paths, routing rules, confidence handling and where to run it. Where most documents are structured e-invoices, Business Central and Finance e-invoicing features may already handle routing without an agent.

## Pain Points

### Shared inboxes as a bottleneck

**Detail:** One or two people triage hundreds of documents a day; when they are away, invoices age and certificates go missing.

### Weak links between documents and records

**Detail:** Documents saved on file shares are not attached to POs, receipts or lots, so audits become hunts.

### Reference numbers are messy

**Detail:** Vendors quote their own order numbers, customers abbreviate part numbers, and PO numbers appear with typos.

### Mixed sensitivity

**Detail:** Drawings and technical data for controlled programs arrive alongside routine invoices and need different handling.

### No measurement

**Detail:** Nobody knows how many documents arrive by type or how long routing takes, so improvement has no baseline.

## Use Cases

### Inbound document classification

**Description:** The agent classifies each attachment into classes such as vendor invoice, customer PO, acknowledgement, packing list, certificate, drawing or other.

**Erp Objects:** Shared mailbox, SharePoint library, document class list

**Outcome:** Documents sorted on arrival with confidence scores.

### PO and receipt matching for supplier documents

**Description:** For supplier documents, the agent extracts PO and line references, matches them to open purchase lines and product receipts, and attaches the document.

**Erp Objects:** F&O PurchTable, PurchLine, VendPackingSlipJour; Business Central Purchase Header, Purch. Rcpt. Header

**Outcome:** Supplier documents attached to the right PO without manual search.

### Customer PO to sales order routing

**Description:** Customer POs are matched to customer accounts and either attached to an existing order or routed to order entry with a draft.

**Erp Objects:** CustTable, customer external item references, SalesTable; Business Central Customer, Item Reference, Sales Header

**Outcome:** Order entry receives prepared drafts.

### Certificate attachment by lot

**Description:** Certificates are matched to receipts by PO, item and lot or heat number and attached to the batch record.

**Erp Objects:** InventBatch, product receipts, quality orders, document attachments

**Outcome:** Certificates traceable by lot for audits.

### Drawing and revision routing

**Description:** Drawings and specifications are routed to engineering or document control with the part and revision identified, and never to general queues.

**Erp Objects:** Engineering change records, item revisions, PLM

**Outcome:** Controlled documents reach the right owner.

### Exception queue with reasons

**Description:** Documents the agent cannot classify or match go to a queue with a reason such as no PO found or ambiguous vendor.

**Erp Objects:** Dataverse queue or SharePoint list, agent log

**Outcome:** People handle only the true exceptions.

### Routing metrics

**Description:** Daily counts by class, match rate and time to route give a baseline and show where vendors need onboarding.

**Erp Objects:** Agent logs, Power BI or reporting store

**Outcome:** Visible improvement and vendor follow-up lists.

## Architecture

**Overview:** The agent is a pipeline with a language or vision model at the classification and extraction steps, deterministic matching against ERP data, and rules for routing. The model does not decide where documents go by itself; the rules do.

**Layers:**

#### Intake

**Detail:** Mailbox and folder watchers capture documents with sender and subject metadata.

#### Classification and extraction

**Detail:** AI Builder models, a Copilot Studio agent or a private vision-language model classify and extract references.

#### ERP matching

**Detail:** Lookups against open POs, receipts, customers and items through F&O OData entities or Business Central API v2.0, with fuzzy matching on references.

#### Attachment and routing

**Detail:** Attach via document management in F&O or incoming documents and attachments in Business Central; route to queues by rules.

#### Audit and metrics

**Detail:** Every decision logged with confidence and matched record IDs.

## Deployment Options

### Power Platform build

**Fit:** Most document types with data allowed in Microsoft cloud.

**Detail:** Power Automate plus AI Builder or Copilot Studio, governed by DLP policies.

### Hybrid

**Fit:** Mixed sensitivity documents.

**Detail:** Classification routes restricted documents to a private pipeline before any cloud processing.

### Private agent

**Fit:** Defense and aerospace suppliers handling controlled technical data.

**Detail:** Private model on customer GPUs; attaches to Dynamics over the internal network.

## Compliance

### Controlled drawings are detected early and kept within authorised processing paths and queues.

**Framework:** ITAR and EAR

### Drawings and specifications route to document control; the agent does not release revisions.

**Framework:** AS9100 document control

### Invoices become drafts or attachments; approval and posting remain manual and logged.

**Framework:** SOX

### Documents are attached to ERP records with retention policies applied in SharePoint or document management.

**Framework:** Records retention

## Integration Notes

- In F&O, document management attachments link files to records such as purchase orders; configure document types and storage location first.
- In Business Central, incoming documents and the attachment framework link files to purchase and sales documents.
- Classify before extraction so restricted documents never reach a cloud model.
- Use vendor item references and customer item cross-references to resolve part numbers.
- Set a confidence threshold per class; route below-threshold documents to people with the agent's best guess.
- Keep a sender to vendor or customer map to improve matching over time.

## Product Fit

### Custom build

**Why:** Routing agents are shaped by each company's document mix and references; a bespoke build, cloud or private, fits best.

### DataRay

**Why:** Once documents are classified and attached, DataRay lets people search and ask questions across them alongside ERP data.

## Engagement

### Document census

**Duration:** 1-2 weeks

**Deliverables:**

- Sample of a month of inbound documents
- Class definitions
- Sensitivity rules
- Baseline routing time

### Agent pilot

**Duration:** 4 weeks

**Deliverables:**

- Classification and matching pipeline
- Attachment to ERP
- Exception queue
- Accuracy report

### Rollout

**Duration:** 3-4 weeks

**Deliverables:**

- All mailboxes connected
- Routing rules finalised
- Metrics dashboard
- Runbook

### Improve

**Duration:** Ongoing

**Deliverables:**

- Vendor onboarding feedback
- New classes
- Threshold tuning
- Quarterly review

## Buyer Questions

- Which document classes and volumes do we actually receive?
- How does the agent handle documents it cannot match?
- Are restricted documents identified before any cloud processing?
- Does it attach to ERP records or just move files?
- How is accuracy measured and reported?
- Who maintains routing rules when the organisation changes?

## Faq

### What is a document routing agent for Dynamics 365?

**Answer:** It is an automated assistant that reads inbound documents, decides what each is, links it to the right Dynamics record such as a purchase order, receipt or sales order, attaches it and sends it to the right queue or person. It uses AI for classification and extraction and rules for matching and routing.

### Does Microsoft provide a document routing agent?

**Answer:** Microsoft provides components rather than one universal routing agent: AI Builder document models, Copilot Studio, Power Automate, and e-document features in Business Central and Finance. These can be assembled into a routing agent. Check current release plans, as Microsoft continues to add agents for document-heavy processes.

### How accurate can document routing be?

**Answer:** Classification of common document types is usually reliable; matching depends on how consistently references appear. Expect a share of documents to need human help at first, falling as sender maps and thresholds are tuned. Measure match rate by class rather than one overall number.

### Can it handle drawings and controlled documents?

**Answer:** It can identify them and route them to engineering or document control, but it should never release revisions. For export-controlled drawings, classify before any cloud processing and keep them in a private pipeline.

### What about structured e-invoices?

**Answer:** Structured invoices in formats such as PEPPOL or national e-invoicing schemes do not need AI extraction. Business Central and Finance e-invoicing features import them directly. The routing agent is most useful for PDFs and scanned documents.

### Can it write records into Dynamics?

**Answer:** It can create drafts, such as pending vendor invoices or sales quote drafts, and attach files. Posting and confirmation should stay with people under existing approval workflows.

### How long does it take to build?

**Answer:** A pilot on two or three document classes typically takes about a month, including census, pipeline, matching and exception queue. Adding classes and mailboxes is incremental after that.

## Search terms

dynamics 365 document routing agent, document routing agent dynamics 365, dynamics 365 document ai, business central document automation, d365 document classification ai, copilot studio document agent, ai document routing erp, dynamics 365 inbound document processing, certificate of conformance automation dynamics, private document agent dynamics

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
