Building Intelligent Dynamics 365 Agents with Microsoft Copilot Studio – Procurement Automation Made Practical

Digital procurement has moved far beyond just processing purchase orders. Today, the real impact comes from how quickly teams can surface the right information and act on it. Dynamics 365 already holds that intelligence, but getting to it often means clicking through layers of forms, journals, and reports. That’s exactly where Microsoft Copilot Studio steps in.
In our previous post, “Building Intelligent Dynamics 365 Agents with Microsoft Copilot Studio,” we explored how Copilot Studio turns ERP/CRM depth into natural, secure conversations. Instead of spelunking through forms and reports, users can just ask questions-“Show me the top 20 vendors by defect rate this quarter,” “Summarize overdue receivables for my accounts,”and get precise answers grounded in Dynamics data and business logic.
This installment takes that vision from concept to concrete with a high-impact scenario in Dynamics 365 Finance & Operations (D365FO): spotting and communicating purchase order price changes. Procurement teams routinely need to verify whether a confirmed PO’s price deviated from what was originally entered-and then notify vendors when it does. Done manually, this is slow, error-prone, and easy to miss.
We show how to solve it with two pieces that work together:
- A custom Copilot agent in D365FO (via an X++ plugin exposed as a Dataverse Custom API) that, on request, returns old vs. new prices for confirmed purchase orders-PO number, first/latest confirmation IDs, vendor context, and the price delta-right in chat.
- A Power Automate flow that runs on a schedule, calls the same Custom API, groups changes by vendor, and sends clear, formatted emails so vendors can review and confirm updates promptly.
By combining Copilot Studio’s conversational interface with Dataverse extensibility and Power Automate’s orchestration, you get instant insight for buyers and proactive communication for vendors-a practical pattern you can replicate across other Dynamics processes.
From Manual Checks to Smart Alerts: A Custom Copilot + Power Automate Pattern for PO Price Changes in D365FO
In this post, we’ll show how we can build custom automated workflows in Dynamics 365 Finance & Operations (D365FO) with a two-part solution for the current problem statement of identifying purchase orders with price change:
- a Custom Copilot agent that instantly compares old vs. new prices for confirmed POs, and
- a Power Automate workflow that emails vendors a daily digest of their price changes.
Together, they turn a time-sink into a one-click insight-and push the right information to vendors automatically.
| The Business Problem (and Why It’s Tricky)
Prices on purchase orders move for all sorts of reasons: quantity corrections, discounts, and market swings. Verifying changes means digging through:
- the original PO line values, and
- the confirmation journal values.
We wanted two outcomes:
- On-demand clarity: “Show me confirmed POs and highlight price differences.”
- Proactive communication: notify vendors daily when their prices changed so they can confirm quickly.
| Solution at a Glance
Platform: D365FO v10.0.38 + Copilot + Dataverse + Power Automate + O365 Mail
- Copilot in D365FO → Users ask for a list of confirmed POs. The agent returns PO, vendor, first/last confirmation IDs, old price, new price-no navigation required.
- Power Automate → A scheduled flow calls a Custom API, groups changes by vendor, and sends structured HTML emails with the differences.
The Custom Copilot Agent (Price Comparison On-Demand)
What users ask
“Show me the list of confirmed purchase orders.”
What they get
A tabular response like:
PO Number | PO Version | New Version | Total Amount | New Amount |
00000046 | 00000046-1 | 00000046-2 | 36,000 | 36,500 |
00000075 | 00000075-1 | 00000075-2 | 1,078.8 | 1,678.8 |
00000011 | 00000011-1 | 00000011-2 | 23,290.68 | 25,290.68 |
How it works (architecture)
- X++ Plugin Operation
- A class decorated with AIPluginOperationAttribute fetches comparison data without performing confirmation.
- It reads from PurchTable and VendPurchOrderJour to derive:
- PO number, vendor account/name/email
- First confirmed ID & old price (from PO line)
- Latest confirmed ID & new price (from confirmation journal)
- PO number, vendor account/name/email
- A class decorated with AIPluginOperationAttribute fetches comparison data without performing confirmation.
- Data Contract
Output includes:- Purchase order no, vendor account/name/email
- First confirmed id, old price
- Latest confirmed id, new price
- Purchase order no, vendor account/name/email
- Dataverse Custom API
- The X++ operation is exposed as a Custom API and synced to Dataverse for consumption.
4. Security
Menu item tied to the X++ class; role grants read on PO + confirmation journal.
5. Copilot Studio Integration
- The Custom API is added as a Tool/Action with trigger phrases like “Show list of confirmed purchase orders.”
6. Testing
- Positive cases (changed price), unchanged cases, invalid PO handling.
- Positive cases (changed price), unchanged cases, invalid PO handling.
Why this matters: Business users ask a natural question; Copilot returns a clean, explainable answer sourced from the journals you already trust.
Part 2 – Power Automate: Daily Vendor Notifications
| Objective
Detect confirmed POs with price changes and email each vendor a daily summary-no human coordination required.
| Flow Overview
- Trigger (Recurrence)
- Runs daily (IST / UTC+05:30).
- Dataverse Action
- Calls the same Custom API (e.g., Cr3d9fc_OW_CustomAPIPOConfirmation) to fetch confirmed POs with modifications.
- Calls the same Custom API (e.g., Cr3d9fc_OW_CustomAPIPOConfirmation) to fetch confirmed POs with modifications.
- Processing & Email Build
- Extract unique vendor emails.
- For each vendor, append their PO rows into a well-formatted HTML table.
- Extract unique vendor emails.
- Conditional Send
- Only send if a valid email exists; log skipped cases.
- Only send if a valid email exists; log skipped cases.
| Why Power Automate here?
- Native connectors to Dataverse and O365
- JSON parsing, loops, conditions-all no-code
- Easy to schedule, monitor, and audit
| End-to-End Flow (How the Two Pieces Fit)
- User Insight (Pull): A buyer wonders about price drift → asks Copilot → gets old vs. new instantly.
- Vendor Communication (Push): Overnight, the flow runs → groups updates by vendor → sends a concise summary email each morning.
You get both visibility for buyers and discipline for vendor confirmations.
| Technical Highlights (and a Glimpse at the X++)
- The X++ class serializes a list contract to JSON and exposes it via a Custom API:
- Filters VendPurchOrderJour entries
- Finds “first” vs. “latest” confirmations
- Compares amounts / prices and emits a structured payload
- Filters VendPurchOrderJour entries
- Copilot Studio consumes this as a Tool, so prompts trigger the Custom API automatically.
- Power Automate consumes the same Custom API, so you avoid double-implementation and maintain one source of truth for “what changed.”
| Security & Governance
- Restrict the menu item to a role with read permissions on Purchase Orders and Confirmation Journals.
- Scope the Custom API execution to least privilege.
- In Power Automate, secure the connection references to Dataverse and O365 Mail.
- Log outcomes (emails sent, vendors skipped, zero-change days).
| Benefits You’ll See Immediately
- Speed: Seconds to answer “what changed” vs. manual form spelunking.
- Accuracy: One calculation path feeds Copilot and Power Automate.
- Transparency: Buyers and vendors see the same numbers pulled from the confirmation journals.
- Scale: As volume grows, the automation keeps pace-no extra headcount.
| Roadmap & Easy Enhancements
- Line-level detail: Extend the Custom API for per-line comparisons (not just totals) and any other such use cases.
- Variance %: Include percentage deltas to quickly spot big jumps.
- Tolerance rules: Flag and notify only when change exceeds thresholds.
- Adaptive emails: Embed call-to-action links for vendors to acknowledge changes.
- Exception dashboard: A small Power BI visual over the API output for trend monitoring.
| What the Email Looks Like (Example)
| Final Take
What this pattern proves is simple: you don’t need to replace core ERP processes to make them feel modern-you just need to wrap them with intelligence and orchestration. By exposing trusted business logic as a reusable Custom API and letting Copilot Studio and Power Automate sit on top, you convert multi-click checks and ad-hoc emails into one conversational query and one scheduled flow. The result is less swivel-chair work, faster cycle times, and decisions made where the context already lives.
The impact compounds quickly:
- Time-to-insight: minutes of navigation become seconds of answers.
- Consistency & trust: one source of truth (the same API) powers both on-demand chat and automated outreach.
- Operational discipline: proactive notifications standardize vendor communication and reduce follow-ups.
- Governance: security roles, Dataverse policies, and auditability stay intact-no shadow logic.
More importantly, the approach is portable. The same building blocks (Custom API + Copilot Tool + Flow) can target other domains without re-architecting your stack:
- Finance: tolerance-based variance alerts, auto-summaries of late postings, smart close checklists.
- Procurement: line-level price deltas, approval routing in Teams, exception dashboards in Power BI.
- Supply Chain: ETA drift notifications, shortage risk explanations with recommended actions.
- Sales/Service: account health digests, contract renewal nudges, case de-duplication prompts.
Looking ahead, you can enrich these flows with threshold policies, human-in-the-loop approvals, Adaptive Cards in Teams, anomaly detection, and retrieval-augmented (RAG) explanations that cite supporting documents. Each addition is incremental: keep the API, expand triggers and prompts, and tighten guardrails as adoption grows.
In short, pairing Copilot Studio with Dataverse and Power Automate turns your existing Dynamics processes into composable, conversational, and automated experiences. It’s a pragmatic path to AI-assisted operations-one high-value scenario at a time.
Ready to make procurement workflows smarter? Start by identifying one high-impact scenario in your D365 environment and apply this Copilot + Power Automate pattern. Small steps compound fast,get your team using it this quarter.
| FAQS
Microsoft Copilot Studio brings intelligence to Dynamics 365 Finance & Operations by replacing manual navigation with natural queries. Instead of drilling into multiple forms, procurement teams can ask Copilot about purchase order price changes and instantly get structured comparisons. By connecting Dataverse Custom APIs with Power Automate workflows, it turns tedious verification tasks into fast, reliable, and automated insights.
Yes. A Custom Copilot agent in D365FO can detect price variances between original and confirmed purchase orders on demand. It fetches PO details, compares the first and latest confirmation journals, and highlights price deltas clearly. This eliminates guesswork, speeds up reviews, and ensures procurement teams spot discrepancies instantly without manually opening PO line or confirmation forms repeatedly.
Daily vendor notifications are automated through Power Automate. A scheduled recurrence flow calls the same Dataverse Custom API, groups purchase order price changes by vendor, and builds clean HTML summary emails. Each vendor receives a structured list of updated POs, enabling quick reviews and confirmations. This removes manual coordination, standardizes procurement communication, and keeps suppliers informed without extra buyer effort.
Yes. Security is baked in through Dataverse roles, menu-item permissions in Dynamics 365, and least-privilege API access. Only authorized procurement users can run the Custom API. In Power Automate, connection references are secured, and each run is logged for auditing. This ensures vendor data, purchase order details, and price variance calculations remain protected while enabling automation and collaboration confidently.
Absolutely. The Custom API + Copilot + Power Automate pattern is flexible. You can apply it to invoice matching, procurement tolerance alerts, supply chain ETA drifts, or financial variance checks. Since Copilot queries and flows consume the same trusted API, you avoid rework. Enhancements like threshold rules, Teams notifications, or Power BI dashboards can scale automation to other business areas easily.