TL;DR
A custom agent in Microsoft Dynamics 365 Business Central can automatically assign salespeople to customers based on location. This reduces manual data entry, ensures consistent territory alignment, and provides full visibility through task logs for easy tracking and optimization.
Salesperson Alignment Custom Agent in BC
Microsoft recently introduced the ability to create your own agents in Microsoft Dynamics 365 Business Central, marking a meaningful step toward bringing agentic AI into ERP workflows. This capability is designed to help users understand how AI-powered agents can operate within Business Central. By building your own agents, you gain hands-on experience with automation and better insight into how these tools can support your business processes.
In this walkthrough, we’ll set up a custom agent and explore how it works behind the scenes.
Why Use a Sandbox Environment
I’m currently working in a sandbox environment, and this is critical. If you’re testing agents for the first time, you should avoid using your production system.
Safe Testing First
A sandbox allows you to experiment freely, test logic, and refine your approach without risking live business data. It’s the ideal place to learn how agents behave and iterate quickly.
Creating the Custom Agent
In my environment, I already have two standard agents from Microsoft: a sales order agent and a payables agent. After testing those, I created a new custom agent from scratch using the built-in creation option.
Agent Overview
This custom agent is called “Salesperson Alignment.” Its role is simple but powerful: it assigns salespeople to customers based on geographic location. The agent reviews each customer record and determines the appropriate salesperson based on where that customer is located.
Configuration and Permissions
The agent is active and includes basic configuration such as description, assigned profile, and permissions. Since this is a sandbox, permissions are intentionally broad to allow full flexibility during testing.
Defining the Assignment Logic
The agent operates on master data and uses a clear set of instructions to guide its behavior.
Role and Objective
The instructions define the agent’s role within the organization. Its primary task is to assign salespeople to customers and ensure all updates are saved properly.
Location-Based Rules
The assignment logic is based on the customer’s physical location, such as state or region. This ensures that each customer is aligned with the appropriate salesperson responsible for that area.
Before running the agent, the customer list shows no assigned salesperson codes. With around 50 customers and seven salespeople, this is an ideal scenario for automation.
Running the Agent Task
Once the setup and instructions are confirmed, the next step is to execute the agent.
Task Execution
You simply initiate a task, optionally give it a name, and run it. In this case, no additional instructions were needed, and the task was executed directly without saving it as a template.
While the agent runs, you can continue working in Business Central. After a short period, the task completes.
Reviewing Results and Performance
After completion, you can review the steps taken by the agent and analyze the outcome.
Customer Updates
Looking at the customer records, each one now has a salesperson code assigned. This confirms that the agent successfully applied the logic across all records.
Cost Transparency
The system also shows the cost of running the agent. In this example, it used 162 Copilot credits, which is under $2.00. This highlights how cost-effective it is to automate repetitive updates at scale.
Exploring the Agent Card and Logs
To better understand what happened, you can navigate to the agent card and review task history.
Detailed Task Logs
The logs provide a step-by-step breakdown of the agent’s actions. You can see how it opens each customer record, updates the salesperson field, saves the change, and moves to the next record.
Troubleshooting and Insights
This level of visibility is extremely useful for troubleshooting. If something goes wrong, you can quickly identify where and why it happened.
Iterating and Improving Your Agent
Working with agents is not a one-time task. It’s an iterative process where you continuously refine instructions and logic.
Learn and Optimize
As you run the agent multiple times, you’ll gain a deeper understanding of how it behaves and how to improve it. Over time, you can make the logic more precise and tailored to your business needs.
A helpful reminder comes from Tony Robbins: “AI is not going to replace you, but someone using AI effectively may replace you.” The message is clear—now is the time to start learning and applying AI tools.
Getting Started with Copilot
To use agents effectively, you’ll need access to Copilot within Microsoft 365.
Setup Requirements
Start by creating a sandbox environment in Business Central, then configure a Copilot pay-as-you-go plan. Microsoft provides some initial credits, but they are limited, so setting up billing ensures you can continue experimenting without interruption.
Once configured, you can connect Copilot to your sandbox and begin building agents immediately.
Final Thoughts
This example demonstrates a simple but impactful use case: automatically assigning salespeople to customers using a custom agent in Microsoft Dynamics 365 Business Central.
We covered how to configure the agent, define logic, run tasks, review logs, and validate results. While this is a basic example focused on master data, it provides a strong foundation for understanding how agents work.
As you grow more comfortable, you can collaborate with developers to build more advanced, secure, and scalable solutions tailored to your organization.
If you’re ready to deploy Copilot in Microsoft 365, download our free guide using the link in the video description.
Related Demos
Try Dynamics 365 Business Central Today
![]()
Chat with a Customer Service Rep.
Available Monday-Friday
9 AM to 6 PM Pacific Time.
USE THE CHAT BOX >





