community postCopilot & Agentscommunity - not Microsoftreviewed - checked by Opus

Using CoPilot to Upgrade Service Notes for Invoices in Business Central AL

This post demonstrates how to use Copilot to automatically upgrade raw service technician notes into professional, customer-facing text for invoices in Business Central. It addresses the common problem of processing hundreds of poorly written service notes daily by creating a table for resolution notes, extending the Sales Header with a BLOB field, and implementing a Copilot prompt dialog that generates formatted HTML summaries.

post Aardvark Labs

Marcel Chabot · 2025-10-31 · 2,546 words · about 12 min

"The problem is that the notes are less than sufficient for a customer facing document."

Key points

  • A custom table stores resolution notes linked to sales invoices, allowing technicians to enter raw service details that are later transformed by AI.
  • The solution uses Azure OpenAI chat completion with a carefully crafted system prompt that instructs the AI to act as a service manager and produce professional, jargon-free HTML output.
  • A prompt dialog page uses PageType PromptDialog with PromptMode = Generate to automatically generate and display Copilot suggestions for user confirmation before saving.
  • The generated resolution text is stored in a BLOB field on the Sales Header using UTF-16 encoding and displayed as rich content on the Sales Invoice card.
  • The implementation retries generation up to 5 times if the result is empty, ensuring robustness without overcomplicating the architecture.

Quotes

  • “The problem is that the notes are less than sufficient for a customer facing document.” (Establishes the core business problem that Copilot solves: transforming raw internal notes into polished customer communication.)
  • “The response must be formatted in as HTML.” (Shows that system prompt precision directly controls output format, enabling integration with rich text display controls.)
  • “The user should always be in control (the user must confirm anything Copilot suggests before any change is saved).” (Emphasizes a critical UX principle for Copilot features, preventing unreviewed AI changes from persisting to the database.)

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.

  • table “ARD_ResolutionNotes”
  • table 36 “Sales Header”
  • codeunit “ARD_CopilotResolutionSummary”
  • page “ARD_ResolutionNotes”
  • page “ARD_ResolutionNotesPrompt”
  • page “ARD_SalesInvoice”

Not found in BC28-30: table “ARD_ResolutionNotes”, codeunit “ARD_CopilotResolutionSummary”, page “ARD_ResolutionNotes”, page “ARD_ResolutionNotesPrompt”, page “ARD_SalesInvoice”.

Context

  • Features: Copilot prompt dialog, Azure OpenAI chat completion, BLOB field storage, rich text content, prompt mode generate, system prompt engineering, HTML formatted output, resolution note summarization

Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.