Creating Data Driven Text with AI in Business Central
This post shows how to build a Copilot in Business Central that generates personalized reminder text for overdue customer balances by combining user input with customer data from the database. It demonstrates passing customer name, balance due, last invoice date, and tone to an AI model to create natural-sounding collection letters.

post Aardvark Labs
"We are going to create a Copilot that generates reminder text for overdue balances."
Key points
- Create a new Copilot codeunit that accepts customer data as parameters alongside user input to build dynamic prompts
- Use TextBuilder to combine customer information (name, balance due, invoice date, tone) into a structured user prompt sent to Azure OpenAI
- Configure AI temperature setting (0.7 in this example) to control how creative the model’s output should be
- Retrieve customer and ledger entry data from Business Central tables to feed into the AI prompt
- Add a button to the Customer Card to trigger the reminder generation process with a modal page for user input
Quotes
- “We are going to create a Copilot that generates reminder text for overdue balances.” (Defines the specific use case that demonstrates how to combine BC data with AI for business automation)
- “Temperature is a value from 0.0 to 2.0 defining how creative we want to allow the GPT system to be.” (Explains a key parameter for controlling AI output characteristics based on business requirements)
AL objects mentioned
As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.
- codeunit “ARD_CopilotReminderGenerator”
- codeunit 7771 “Azure OpenAI”
- codeunit 7770 “AOAI Operation Response”
- codeunit 7761 “AOAI Chat Completion Params”
- codeunit 7763 “AOAI Chat Messages”
- codeunit 7768 “AOAI Deployments”
- codeunit “ARD_IsolatedStorageWrapper”
- codeunit 457 “Environment Information”
- table 18 “Customer”
- table 21 “Cust. Ledger Entry”
- page “ARDReminderPrompt”
Not found in BC28-30: codeunit “ARD_CopilotReminderGenerator”, codeunit “ARD_IsolatedStorageWrapper”, page “ARDReminderPrompt”.
Context
- Features: Copilot prompt engineering with dynamic data, Azure OpenAI Chat Completion integration, Customer data lookup and filtering, Temperature control for AI creativity, User prompt builder with multiple parameters, Customer Card action for reminder generation, Modal page for user input and tone selection
Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.