D365 document routing agent
Building a Document Routing Agent for Dynamics 365: Classify, Match, Attach and Route
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.
- ERP
- Dynamics 365 Finance and Operations, Dynamics 365 Business Central, Microsoft Copilot Studio, SharePoint
- Industries
- Manufacturing, Aerospace, Distribution
- Written for
- ERP Manager
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.
What usually gets in the way
The problems we hear most from erp manager teams running Dynamics 365 Finance and Operations.
Shared inboxes as a bottleneck
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
Documents saved on file shares are not attached to POs, receipts or lots, so audits become hunts.
Reference numbers are messy
Vendors quote their own order numbers, customers abbreviate part numbers, and PO numbers appear with typos.
Mixed sensitivity
Drawings and technical data for controlled programs arrive alongside routine invoices and need different handling.
No measurement
Nobody knows how many documents arrive by type or how long routing takes, so improvement has no baseline.
Where AI earns its place in Dynamics 365 Finance and Operations
Each use case names the ERP objects it reads or writes, so your ERP team can judge the integration effort before anyone commits budget.
Inbound document classification
The agent classifies each attachment into classes such as vendor invoice, customer PO, acknowledgement, packing list, certificate, drawing or other.
Touches: Shared mailbox, SharePoint library, document class list
Outcome: Documents sorted on arrival with confidence scores.
PO and receipt matching for supplier documents
For supplier documents, the agent extracts PO and line references, matches them to open purchase lines and product receipts, and attaches the document.
Touches: 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
Customer POs are matched to customer accounts and either attached to an existing order or routed to order entry with a draft.
Touches: CustTable, customer external item references, SalesTable; Business Central Customer, Item Reference, Sales Header
Outcome: Order entry receives prepared drafts.
Certificate attachment by lot
Certificates are matched to receipts by PO, item and lot or heat number and attached to the batch record.
Touches: InventBatch, product receipts, quality orders, document attachments
Outcome: Certificates traceable by lot for audits.
Drawing and revision routing
Drawings and specifications are routed to engineering or document control with the part and revision identified, and never to general queues.
Touches: Engineering change records, item revisions, PLM
Outcome: Controlled documents reach the right owner.
Exception queue with reasons
Documents the agent cannot classify or match go to a queue with a reason such as no PO found or ambiguous vendor.
Touches: Dataverse queue or SharePoint list, agent log
Outcome: People handle only the true exceptions.
Routing metrics
Daily counts by class, match rate and time to route give a baseline and show where vendors need onboarding.
Touches: Agent logs, Power BI or reporting store
Outcome: Visible improvement and vendor follow-up lists.
Reference architecture
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.
- 1
Intake
Mailbox and folder watchers capture documents with sender and subject metadata.
- 2
Classification and extraction
AI Builder models, a Copilot Studio agent or a private vision-language model classify and extract references.
- 3
ERP matching
Lookups against open POs, receipts, customers and items through F&O OData entities or Business Central API v2.0, with fuzzy matching on references.
- 4
Attachment and routing
Attach via document management in F&O or incoming documents and attachments in Business Central; route to queues by rules.
- 5
Audit and metrics
Every decision logged with confidence and matched record IDs.
Integration notes for your ERP team
- 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.
Deployment options
Power Platform build
Most document types with data allowed in Microsoft cloud.
Power Automate plus AI Builder or Copilot Studio, governed by DLP policies.
Hybrid
Mixed sensitivity documents.
Classification routes restricted documents to a private pipeline before any cloud processing.
Private agent
Defense and aerospace suppliers handling controlled technical data.
Private model on customer GPUs; attaches to Dynamics over the internal network.
Compliance and data control
How the architecture supports your obligations. Certification and accountability stay with your organisation; the design keeps the evidence straightforward.
ITAR and EAR
Controlled drawings are detected early and kept within authorised processing paths and queues.
AS9100 document control
Drawings and specifications route to document control; the agent does not release revisions.
SOX
Invoices become drafts or attachments; approval and posting remain manual and logged.
Records retention
Documents are attached to ERP records with retention policies applied in SharePoint or document management.
How an engagement runs
Phase 1 . 1-2 weeks
Document census
- -Sample of a month of inbound documents
- -Class definitions
- -Sensitivity rules
- -Baseline routing time
Phase 2 . 4 weeks
Agent pilot
- -Classification and matching pipeline
- -Attachment to ERP
- -Exception queue
- -Accuracy report
Phase 3 . 3-4 weeks
Rollout
- -All mailboxes connected
- -Routing rules finalised
- -Metrics dashboard
- -Runbook
Phase 4 . Ongoing
Improve
- -Vendor onboarding feedback
- -New classes
- -Threshold tuning
- -Quarterly review
Questions to ask any vendor, including us
A short list that separates real Dynamics 365 Finance and Operations AI work from a chatbot demo.
- 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?
Frequently asked questions
What is a document routing agent for Dynamics 365?
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?
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?
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?
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?
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?
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?
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.
Related guides
AI Builder for Dynamics 365 ERP: Document Processing, Prompts and Prediction, With Limits
How AI Builder works with Dynamics 365 ERP: invoice and document processing, prompts, prediction, credit costs, and when a private model is the better fit.
AP automation + on-prem AIAI for accounts payable invoice matching in your ERP
On-prem AI reads vendor invoices, runs 3-way match against your ERP PO and receipt, and routes only real exceptions to your AP team. No invoice data leaves your network.
Dynamics 365 agentsDynamics 365 AI Agents for ERP: Prebuilt Agents, Copilot Studio and When to Build Your Own
How Dynamics 365 AI agents work in Supply Chain and Finance, how to build your own in Copilot Studio, and when a private agent on your servers fits better.
Business Central + discrete mfg AIAI for Dynamics 365 Business Central in Discrete Manufacturing
Grounded AI for Dynamics 365 Business Central discrete manufacturers: production orders, planning worksheets, routings and costing, on a private LLM.
PO follow-up that does not wait on a personAI Purchase Order Automation: Supplier Follow-Up and Expedite Without a Buyer Chasing Email
AI drafts routine PO confirmation and expedite messages from open ERP order data, with a buyer approving every message and change before it goes out.
D365 F&SCM + private AIAI for Dynamics 365 Finance and Supply Chain beyond Copilot
AI for D365 Finance and Supply Chain beyond Microsoft Copilot: private LLM grounded on data entities and OData, on-prem-capable via Local Business Data.
Plan it with numbers
Document Classification Taxonomy Worksheet
Define the document types your inbox and scanners receive, how each is classified and extracted, and how many review hours each type will create.
Free ToolDocument Ingestion Pipeline Estimator
Estimate total pipeline time from document count, OCR share, and embedding throughput, so ingestion timelines stop being a guess in the project plan.
Free ToolDocument Capture Confidence Threshold Simulator
Simulate where to set the auto-accept confidence threshold by weighing review labor against the cost of errors that slip through.
GuideBuilding an AI Document Processing Pipeline: OCR to Validation
How to build an AI document processing pipeline: OCR quality, LLM extraction, schema validation, and the human review layer that catches what slips through.
GuideAI Document Processing for ERP: Invoices, POs, and Packing Slips
Automate invoice, PO, and packing slip processing into ERP with AI document extraction. Covers OCR, layout analysis, validation rules, and ERP posting.
GuideYour First AI Agent: A Manufacturing Playbook
Your first AI agent in manufacturing: pick a bounded ERP use case, scope data access, set guardrails, and ship a working pilot in 6 to 8 weeks.
Talk it through with an engineer who knows Dynamics 365 Finance and Operations
Bring one real question your team cannot answer from the ERP today. We will map the data path, the model, and where it runs, and tell you honestly if AI is the wrong tool for it.
Try it here, free
Business Central Routing and Production BOM Cost Worksheet
Plan routing operations with setup time, run time, lot size and work center rate, and see operation cost per unit before you set up routings in BC.
Keep exploring
Free tools
- Business Central Routing and Production BOM Cost WorksheetPlan routing operations with setup time, run time, lot size and work center rate, and see operation cost per unit before you set up routings in BC.
- Business Central Setup Checklist (Finance and Manufacturing)A step-by-step checklist for the first setup of a Business Central company, covering finance, inventory, manufacturing, users and go-live basics.
- Business Central Functional Design Document TemplateDocument a Business Central customisation, report or integration with requirement, standard behaviour, gap, design, test and sign-off sections.
ERP fixes and how-tos
- Business Central Manufacturing Setup: Items, BOMs, Routings and Production OrdersSet up Business Central manufacturing: Manufacturing Setup, work centers, production BOMs, routings, item settings, manufacturing policy and demo data.
- Dynamics 365 Supply Chain Management API: OData, Custom Services and Data PackagesD365 Supply Chain / F&O APIs explained: OData data entities, custom services, the data management package API, Entra ID authentication and when to use each.
- Planning an AX 2012 to Dynamics 365 Finance and Operations upgradeHow an AX 2012 to Dynamics 365 Finance and Operations upgrade actually runs: LCS upgrade project, code upgrade of customizations, and data migration, with the main risks.
AI on your ERP
- Dynamics 365 AI Agents for ERP: Prebuilt Agents, Copilot Studio and When to Build Your OwnHow Dynamics 365 AI agents work in Supply Chain and Finance, how to build your own in Copilot Studio, and when a private agent on your servers fits better.
- Dynamics 365 MCP Server: Connecting AI Agents to Finance and Operations, Business Central and DataverseHow MCP servers connect AI agents to Dynamics 365 F&O, Business Central and Dataverse: Microsoft's servers, custom tools, security and private models.
Integrations
- How to add AI agents to Dynamics 365 Finance and Supply ChainHow to add AI agents to Dynamics 365 Finance and Supply Chain: tool layer over OData and business events, approval before writes, on-prem and cloud options.
- How to add AI agents to Dynamics 365 Business CentralHow to add AI agents to Dynamics 365 Business Central: API v2.0 and custom API pages as the tool layer, approval gates, SaaS vs on-prem, and build options.
Software
- Microsoft Dynamics 365 Finance and Supply ChainDynamics 365 Finance and Supply Chain Management explained for manufacturers: modules, data entities, OData, deployment, strengths, limits and alternatives.
- Microsoft Dynamics 365 Business CentralDynamics 365 Business Central explained for manufacturers: modules, APIs, AL extensions, deployment, strengths, limits and alternatives for small and mid-size firms.