Business Central Development Serie - Part 2b: AI for BC Development — The Knowledge Gap That Ships to Production
AI-generated Business Central code can compile and appear functional while containing hidden bugs that silently corrupt data or cause performance issues. Developers must validate AI output across architecture, performance, standard processes, testing, security, and localization before production use, requiring broad domain expertise and proper guardrails.
post Kine's info
"We are drowning not in lies - but in plausible truths."
Key points
- AI-generated AL code can compile and pass basic checks while hiding silent bugs: direct field assignment instead of Validate, filters on fields without keys, and database writes in OnAfterGetRecord.
- Writing Reservation Entry records directly, or building JSON with string concatenation instead of the built-in JSON types, breaks the standard BC infrastructure.
- Validating AI output takes knowledge across many areas: architecture, performance, standard codeunits, object design, upgrade code, locking, testing, CI/CD, security, telemetry, API integration and localization.
- Quality rules should be encoded in agent instructions and guardrails before generation, rather than relying on code review afterwards.
- AI is fine for proofs of concept, learning, low-risk changes and experienced teams with guardrails. It should not ship unvalidated or untested code to production.
Quotes
- “We are drowning not in lies - but in plausible truths.” (Captures the core risk of AI-generated code: it looks correct and functions initially but contains hidden flaws that cause costly production failures in financial systems)
- “AI is not a shortcut past expertise. It is an amplifier of expertise.” (Reframes AI’s role as dependent on existing knowledge; poor guardrails amplify mistakes rather than reduce risk)
- “The gate must be at the input. Encode your rules before the agent writes.” (Establishes that preventing problems through instructions is more effective than catching them in code review)
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 “ItemTrackingManagement”
- codeunit “ReservationEngineMgt”
- codeunit “NoSeriesMgt”
- codeunit “WhseManagement”
- codeunit “GenJnlPostLine”
- codeunit “SalesPost”
- codeunit “PurchPost”
- table 37 “Sales Line”
- table 337 “Reservation Entry”
Not found in BC28-30: codeunit “ItemTrackingManagement”, codeunit “ReservationEngineMgt”, codeunit “NoSeriesMgt”, codeunit “WhseManagement”, codeunit “GenJnlPostLine”, codeunit “SalesPost”, codeunit “PurchPost”.
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- BC Friday Tips #56 Understand Missing Fields in Copy Documents — possibly related: both name Table 37 “Sales Line”
- BC Friday Tips #84 Why Is Your Item Missing from the Sales Line Lookup? — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: Add a Scan Barcode action and scan multiple/Continious scanning (Invoke barcode scanning programmatically from AL) — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: Entering Quantities/Amounts by Calculation and Negative Numbers — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: How to flow/pass custom field values from Sales Order to Production Order — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: How to note the records that the user has selected on the Subpage/Lines (Page.SetSelectionFilter in part) — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: How to quickly check if a field is a primary key field — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: Quickly get next Sequence/Entry Number (without using FindLast -> Entry No. + 1) — possibly related: both name Table 37 “Sales Line”
- Dynamics 365 Business Central: Use a default quantity of 1 for all types on documents – Customization — possibly related: both name Table 37 “Sales Line”
- Implementing a Multi-Step Process for AI Recommendations in Business Central — possibly related: both name Table 37 “Sales Line”
Heads up
- warning: “OnAfterGetRecord fires for every record shown in a list, on a page showing 50 Items, this executes 50 database queries.” (about page page, OnAfterGetRecord)
Context
- Features: validate triggers, item tracking, permission sets, telemetry, error handling, API consumption, localization, JSON handling
Source: Kine’s info, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.