Development tutorial: your first AL extension for Business Central
This Business Central development tutorial takes you from an empty folder to a working extension. You will set up Visual Studio Code and connect to a sandbox. Then you add a field to the customer table and card. Next you react to an event in code. Last, you publish the result. Microsoft's base app stays as it is.
Last updated
Tools for this Business Central development tutorial
Install Visual Studio Code. Next, add the AL Language extension from its marketplace. You also need somewhere to publish. The simplest choice is an online sandbox environment. Any Business Central customer or trial tenant can create one in the admin center. Some developers use a local Docker container instead.
Add Git for source control from the first commit. It gives you history and lets two people work without overwriting each other. It is also the base for automated builds later. Microsoft offers AL-Go for GitHub templates. They give you ready builds once the team grows.
Ask an AL setup question →
- ✓Visual Studio Code
- ✓AL Language extension
- ✓Git client
- ✓Sandbox environment access
- ✓Docker for local containers
Create the project with AL: Go!
Open the command palette and run AL: Go!. Pick a folder, a platform version and the Microsoft cloud sandbox. It creates app.json. That file holds the name, publisher, version, dependencies and ID range. It also creates launch.json for the environment you publish to. A HelloWorld.al sample is added too.
Run AL: Download Symbols next and sign in when asked. Symbols are the definitions of the base application and system objects. Without them, the compiler cannot resolve names such as the Customer table. Then set the ID range in app.json to the numbers that Microsoft reserves for per-tenant extensions.
Ask about app.json settings →- ✓app.json manifest
- ✓launch.json settings
- ✓HelloWorld.al sample
- ✓Symbol packages folder
- ✓Workspace settings file
Add a field in this Business Central development tutorial
Create a file for a tableextension object that extends Customer. Declare a new field inside a fields block, for example a text field for a delivery note. Give it a Caption and a DataClassification. Snippets help. Type ttableext, and the editor offers a skeleton. Prefix your object and field names to avoid clashes with other extensions.
The field exists in the database, but no one can see it yet. Create a pageextension that extends Customer Card. In the layout block, use addlast or addafter. That places a control for your new field, with a ToolTip. Table and page extensions are the everyday building blocks. You cannot edit base objects directly.
Ask about extension objects →- ✓Table and tableextension
- ✓Page and pageextension
- ✓Codeunit for logic
- ✓Report and reportextension
- ✓Enum and enumextension
Add logic with an event subscriber
Business logic goes into codeunits. To change standard behavior, you subscribe to events that Microsoft has published in the base code. Write a procedure with the EventSubscriber attribute, naming the object and the event. A validation trigger on a sales header field is a good first choice. Your code then runs whenever that point is reached.
Keep subscribers short. Move real work into separate procedures that you can test. Use the Error function to stop an invalid action. Use the Message or Notification features to inform users without blocking them. If no suitable event exists, developers can request one from Microsoft.
Ask about event subscribers →- ✓Small single-purpose procedures
- ✓Prefix on every object
- ✓Labels for user messages
- ✓No hard-coded account numbers
- ✓Test codeunits for key rules
Finish the Business Central development tutorial: publish and deploy
Press F5. It compiles, publishes to the sandbox and opens the web client with the debugger on. Set a breakpoint in your subscriber and trigger the action. Then step through the code while you inspect variables. The Page Inspector in the client shows which extension added each field.
When the change is ready, build the .app file. Upload it to production from the Extension Management page. Choose the current or next version as the target. Test again after each Microsoft release wave. Keep the project in Git and tag each version you ship.
Ask about deploying an extension →- ✓Code analyzers switched on
- ✓Permission set included
- ✓Upgrade code where needed
- ✓Version number increased
- ✓Tested in a sandbox copy
Business Central development tutorial questions
What language is Business Central developed in?
Customizations use AL. This language was made for Business Central, and you edit it in Visual Studio Code. It replaced the older C/AL language used in Dynamics NAV. AL code is packaged as extensions. They install and uninstall without altering the base application. So a Business Central development tutorial starts with AL and extensions, not with changes to Microsoft's code.
Do I need a paid license to learn AL development?
A trial tenant with a sandbox environment is enough to follow a beginner tutorial. A local Docker container is another option. Live use needs the customer's own licensed environment. Check Microsoft's current terms for developer and partner licenses. They change from time to time, so read the live page before you plan.
What is the difference between a per-tenant extension and an AppSource app?
A per-tenant extension is built for one customer and uploaded to that customer's environment. An AppSource app goes through Microsoft's marketplace to many customers. It goes through technical validation, and it uses an object ID range assigned to the publisher. So the first suits one business, and the second suits a product.
Can I modify standard Business Central code directly?
Not in the online service. You extend tables, pages and reports, and you subscribe to events to add logic. This split lets Microsoft update the base app often. Meanwhile, your custom work keeps running. It also means an update rarely breaks a well-built extension.
How do I test an extension before an update?
Create a sandbox on the upcoming version from the admin center. Publish your extension there and run your key processes. Automated test codeunits speed this up. Microsoft also notifies administrators when a per-tenant extension is not compatible with a coming release. So a regular sandbox check keeps surprises away from production.
Book a discovery call
Let's talk through your move to Business Central.
A focused call with a senior consultant. We learn how your business runs today, give you an honest view on whether Business Central fits, and outline scope and next steps before you commit to anything.
What happens after you send the form