As we all know, Microsoft is adding Copilot features to everything these days. Every new version of Business Central has more Copilot than the last version and soon there is not a single place in the application that does not have a Copilot feature.
This is great and most people are excited about it. The Copilot features and the underlying AI capabilities are what get people talking when we present Business Central to customers. Most of what I work with are manufacturing companies and almost all of them have their own AI initiatives, sometimes those are just around being creative and coming up with ideas where AI can be applied. Coming up with the ideas seems to almost be harder than the implementation of AI itself.
The Copilot Tools for Business Central
Microsoft have provided us partners with some nice options to build our own Copilot features in Business Central and through this assist our customers with realizing their AI dreams (or at least try to create something that provides what they are looking for). I have created our own Copilot feature for Business Central with the purpose of helping with managing and planning of inventory. I call it Copilot Inventory Queries, and it is available to install and download for free from Microsoft AppSource here:
Copilot Inventory Queries for Business Central
This extension allows you to get AI via the Copilot interface to answer questions like what the reorder point should be for an item, when it is time to replenish it, is it trending up or down, orders in trouble, etc. The result of a query like that looks like below and comes with not just the suggestion but also an explanation to the reasoning behind the suggestion. Pretty nice, right? 🙂

I primarily build this to learn the tools and what the capabilities are, to get on the ‘AI train’ and not just standing on the platform watching it go by. It is surprisingly simple to create, you need to learn the Copilot interface features that Microsoft provides, which are here:
Build the Copilot capability in AL
Or if you are using the fantastic GitHub Copilot feature in Visual Studio then you can just ask that one for help. That piece is my new favorite, maybe for a future post.
The Azure OpenAI Deployment
You need a backend AI model in Azure AI, you set that up in the Azure AI Foundry and it looks like below. From this model you need 3 things; the endpoint, the deployment name of the model and the api key.

I added those 3 things into a setup table in BC like below. For the API key I added some code that stores the value in the isolated storage, so it is not accessible to the rest of the application.

Once you have the backend AI model and a setup table that stores the link to the model you are ready to build the application. The prompts are created with the already defined Copilot prompts in BC, and they come with some animation that runs when BC is waiting for the AI model to reply (looks nice a colorful).
Providing the Prompts
You can prompt it to return just text with an explanation (the way I have it in the above example), or you can prompt it to return structured data that can be used by BC to process (or both actually).
In my case I have defined a system prompt that tells the AI model the following:
The user will provide inventory data from Microsoft Dynamics 365 Business Central along with a question. Use the inventory data to answer the question as best as you can. Include an explanation to your answer.
When the user then enters the question in the prompt the AI model knows that it is related to Business Central and that inventory data will be provided. In my code I then grab the question the user entered, and I add Json formatted inventory related data such as item ledger entries, open orders, etc. The AI model figures it out and the response is displayed to the user.
I am aware that the more data you send to the AI model the longer the repose will take and the more it will cost in terms of AI resources, so I included some features that can compress the item ledger entry data before it is sent to the AI model. I also not sending all the fields from the tables, only fields that would be relevant are sent but I built it so the supplied fields can be changed.
Time to Test the Copilot Prompts
With that done I can now test it, below are some examples of queries and the replies.






I think the above results are very cool, and I can spend lots of time coming up and testing new queries. It is almost like working in a team managing inventory and having a coworker that just knows everything and can answer faster that I can write the questions, and never sleeps. 🙂
Potential Future
My plan with this is to continue improving this solution. I have some ideas to make it explain MRP suggestions, review production allocation across work centers, maybe do some forecasting, etc. So, if you install this extension in your BC environment you will be able to get all the updates along the way. Let me know what you think about this, happy to get feedback, both good and bad…
Below is an introduction video of it as well. Cheers!
Discover more from Olof Simren - Microsoft Dynamics 365 Business Central Blog
Subscribe to get the latest posts sent to your email.






2 Comments
Leave your reply.