Chapter 3: First Steps with AL
Objectives
By the end of this chapter you will be able to:
- Create a minimal AL extension with a table, page, and codeunit
- Explain the role of each object in the extension architecture
- Publish and test your first end-to-end interaction
- Use basic debugging to validate behavior before adding complexity
3.1 Build a minimal vertical slice
Your first AL project should contain one small, complete flow:
- A table for data
- A page to view and edit records
- A codeunit procedure called from the page
Chapters 7 to 16 use the same architecture, and it keeps business logic from piling up in page triggers.
3.2 Keep logic placement intentional
From day one, follow this rule for where logic goes:
- Table trigger: data integrity constraints
- Codeunit procedure: reusable business logic
- Page action: only the entry point that calls codeunit logic
Chapter 9 formalizes this pattern, and Chapter 14 tests it.
3.3 Publish, run, and inspect
After you publish with F5:
- Open your page in Business Central.
- Create sample data.
- Trigger your page action.
- Confirm that the resulting table changes are correct.
If something is wrong, look at what is happening in the debugger before you edit several files.
3.4 Basic debugging loop
Keep the debugging loop tight:
- Reproduce one issue.
- Place breakpoints at object boundaries (page action, then codeunit, then table trigger).
- Inspect
Recvalues before and after procedure calls. - Change one thing, retest, and repeat.
With this habit in place, the Rec vs xRec topic in Chapter 9 is much easier to follow.
Chapter summary
In this chapter you:
- Built and published a minimal extension slice
- Practiced correct logic placement across table, page, and codeunit
- Checked behavior by running the code instead of relying on assumptions
- Set up a debugging workflow you can repeat in later chapters
Tasks
- Create a starter object set. Add one table, one page, and one codeunit.
- Wire an action. Add a page action that calls a codeunit procedure.
- Validate update flow. Confirm the called procedure changes data as expected.
- Try it yourself. Record one bug you found with a breakpoint and what value inspection revealed.
Check your work: your flow should resemble the Chapter 8→9 pattern where a page action invokes codeunit logic instead of embedding business rules inline.