Integrating Copilot with D365 Finance & Supply Chain Management for Beginners


Connecting Microsoft Copilot to your D365 F&SCM system allows you to do more than just read data. It enables you to execute your specific business logic safely and securely.
When implemented correctly, this integration allows Copilot to perform tasks such as calculating a budget or checking a customer’s credit limit, while respecting your existing security rules and code.
Understanding the Architecture
To make Copilot work with your D365 F&SCM system, you need to understand three main components. Think of them as the parts of a car:
- The Engine (X++ Class): This is the code in D365 F&SCM that performs the actual work, such as calculations or data updates.
- The Wiring (Custom API): This connects your code to the outside world, defining the inputs required and the outputs returned.
- The Steering Wheel (Copilot Studio): This controls when and how the action occurs in response to user requests.
How It Works in Practice
1. The X++ AI Tool
An “AI tool” is essentially a standard piece of code wrapped in a specific way so Copilot can understand it. You create a class that:
- Follows a specific template (implements the ICustomAPI interface).
- Uses descriptive labels (attributes) to tell Copilot what the tool does.
- Contains the logic you want to run.
For example, if you want to calculate a customer balance, your class would define inputs like “Customer Account Number” and outputs like “Current Balance.”
2. The Dataverse Connection
Once your code is ready, it needs to be registered in Dataverse (Microsoft’s data platform). This step is crucial because it makes your D365 F&SCM logic visible to Copilot. You will define:
- Name: What the action is called.
- Inputs: Information needed to run the action.
- Outputs: The result returned after the action runs.
3. Wiring it into Copilot Studio
Finally, you use Copilot Studio to teach your AI agent how to use this new tool.
- User Request: A user asks, “What is the balance for customer CAhrens2111?”
- Intent Recognition: The agent understands this request matches your “Calculate Balance” tool.
- Execution: Dataverse calls your API, which triggers your X++ code in D365 F&SCM.
- Response: The result is returned to the user as a natural-language answer.
When to Use This Approach
It is important to evaluate whether this method fits your needs carefully.
Use X++ Custom APIs when:
- The logic already exists in D365 F&SCM and is trusted.
- You need to strictly follow D365 F&SCM security roles.
- The task is a specific, single action (like a calculation).
Avoid this approach when:
- You are building complex workflows that involve multiple systems (use Power Automate instead).
- The logic does not depend on D365 F&SCM data.
Risks and Governance
While building these tools is technically straightforward, doing it safely requires prudence.
- Security: AI tools can bypass some standard checks if not carefully designed. Always ensure they respect user permissions.
- Complexity: Keep your tools simple. Avoid creating one massive tool that tries to do everything.
- Monitoring: Always log usage to track who is using the tools and what actions they are performing.
By following these guidelines, you can seamlessly integrate AI into your ERP system, empowering your users with Copilot while maintaining system integrity and security.