Best practices
Best practices for developing Business Central extensions: AL code conventions, restrictions to avoid, testing, performance, security, telemetry, and connectivity app requirements. It answers how to write, test, instrument, secure, tune, and publish apps so they pass Marketplace validation.
Path: Development > Rules, guidelines, and best practices > Best practices · tier official · system development · narrative unreviewed (model text not yet checked)
Overview
This section collects guidance for building Business Central extensions that are clean, fast, secure, and ready for Marketplace submission. Most of it sits in five subtopics: AL code, Restrictions, Testing, Performance, and Security. Two pages sit directly in the hub: one on adding telemetry and one on requirements for connectivity apps.
Start with AL code for naming, file structure, formatting, prefix and suffix rules, and how to retire code with obsolete attributes. These rules can cause app validation failures. Then read Restrictions to avoid patterns such as UI in web service objects and the obsolete or deprecated company open events. Testing covers the Application Test Toolkit and the checks required before submission.
Performance and Security cover diagnosing bottlenecks, tuning, the layered security model, and Azure Key Vaults for secrets. The telemetry page explains how to add custom signals for production monitoring. The connectivity apps page applies only if you publish banking or external service connectivity apps.
Key points
- AL code guidance covers naming, file structure, formatting, prefix and suffix rules, and deprecation with obsolete attributes and CLEAN symbols.
- Restrictions: avoid UI in web service objects, and avoid the obsolete OnCompanyOpen event and the deprecated OnBeforeCompanyOpen and OnAfterCompanyOpen events, to prevent sign-in errors, login slowdowns and web service exceptions.
- Testing uses the Application Test Toolkit, with a sample Customer Rewards extension showing test codeunits, UI handlers and mocking, plus pre-submission checks.
- Performance pages explain how to measure and locate bottlenecks, then tune pages, web services, AL code, and data access.
- Security covers authentication, authorization, encryption, auditing, change logging, and Azure Key Vaults for extension secrets.
- Telemetry: add custom signals with LogMessage and SendTraceTag, send them to Application Insights or the Event Log, and use the Feature usage system module.
- Connectivity apps listed in Business Central online must meet requirements including app compatibility, 85% test coverage, sales volume thresholds, and regulatory compliance such as PSD2 licensing (2022 release wave 2).
Subtopics
- AL code (4 pages)
- Restrictions (3 pages)
- Testing (3 pages)
- Performance (2 pages)
- Security (2 pages)
More Learn pages
- Adding Telemetry to Your Business Central Application: Instrument Business Central applications with telemetry to analyze usage, troubleshoot problems, and collect events in Application Insights or Windows logs.
- Requirements for connectivity apps: Learn about connectivity apps, how they can increase business productivity, and how to get your app listed as a connectivity app.
Videos, posts and code changes
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- #11870 Reduce allocations in the “Export to Execl” scenario (code change): “The Export to Excel scenario now allocates less memory by reusing objects”
- #108 Complete AL review knowledge readiness (code change): “AL review knowledge expanded with new guidance on telemetry, Query objects, AppSource, breaking changes, and security”
- #114 Document the skill-vs-knowledge boundary so BC facts land in knowledge files (code change): “Skills should contain mechanics while knowledge files hold Business Central facts”
- #119 Add batch-2 FP guards: sentence-case action captions + PK Get is transaction-cached (code change): “Action captions that express imperative commands should use sentence case”
- #130 knowledge(performance): align SetLoadFields placement with AL Guidelines (code change): “align SetLoadFields placement with AL Guidelines by placing filters before SetLoadFields”
- #132 Refine self-improvement review guidance (code change): “BCQuality guidance refined to reduce false positives in event handling, UI testing, performance analysis”
- #133 Add TransferFields SkipFieldsNotMatchingType guidance (code change): “Good pattern: use explicit field-by-field mapping with Evaluate for type conversions to fail loudly”
- #135 Correct severe misconception about SetCurrentKey in the knowledge base (code change): “Using SetCurrentKey when sorting is unnecessary hurts performance”
- #175 9 AL/BC patterns: document distribution, price calculation & barcode extensibility (code change): “Nine new AL/BC patterns document best practices for document distribution”
- #183 Add reporting review guidance and evaluation fixtures (code change): “Included bad and good AL code samples for each rule to guide developers”
- #196 Strengthen review contracts and add AL reliability guidance (code change): “Strengthen review contracts and add AL reliability guidance. Adds seven AL reliability rules”
- #251 Clarify 20-character limit for assignable permission set names (code change): “Includes best practice showing full names with prefix/affix must fit 20 characters”
- #290 Attachment cleanup by document type (code change): “Quality guidance added for Business Central 29 on scoping attachment cleanup”
- #98 Add P0 event and interface compatibility knowledge (code change): “Guidance added for event and interface compatibility patterns, covering enum unknown value handling”
- When “Errors” Don’t Stop the Process: A Hidden Risk in Business Central (community post): “Safe usage pattern: validate first with error collection”
- Get the new BCQuality plugin for VS Code! (community post): “helps AI agents and AL developers generate better code for Business Central”
- Introducing the “No Shortcuts” Series: The 100% Correct Way to Develop for Business Central (community post): “Shortcuts in development create technical debt and upgrade problems tomorrow”
- BC Friday Tips #68 Always Use Field Validation (community post): “Field validation in Business Central extensions ensures all business logic runs and prevents data corruption”
- BCQuality: A Shared Quality Bar for AL Code, Built for Agents (community post): “organizes domain-specific rules in markdown files filtered by BC version”
- Dynamics 365 Business Central: Suggested Abbreviations (community post): “Gives file-naming abbreviations for AL object types”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.
What Learn documents here 8 of 16 Learn pages
- learnAdding Telemetry to Your Business Central Application2026-11-17
- learnAzure Key Vaults with Business Central2026-10-08
- learnBe careful about UI for web services2023-04-11
- learnBest practices for AL code2026-02-19
- learnBest Practices for Deprecation of AL Code2024-04-30
- learnBuilding an Advanced Sample Extension2026-11-30
- learnHow to work with a performance problem2026-09-18
- learnLayered security model in Business Central2025-11-19
Show 8 more
- learnMoving from OnCompanyOpen2022-05-23
- learnPerformance Articles for AL Developers2026-09-18
- learnPrefix and suffix for naming in extensions2023-04-11
- learnReplacing OnBeforeCompanyOpen and OnAfterCompanyOpen2024-05-01
- learnRequirements for connectivity apps2023-05-23
- learnRules and guidelines for AL code2026-12-01
- learnTest the advanced sample extension2026-12-01
- learnTesting your extension2023-04-11