Building the World's Best ControlAddIn for AL code in Business Central
Eric's open source starter control add-in for AL in Business Central covers flexible height control, keyboard routing, caption translation and resource streaming. It also covers the user control host page type, which has no page close event and is risky for editable data.
- Introduction to control add-in challenges
- Demo - control add-in overview and height control
- Height adjustment features and flexibility
- Keyboard routing and accessibility
- Captions, translations, and content loading
- Repository structure and user control host page type
- Code walkthrough - load content and event handling
- Resource management and HTML rendering
- Summary and call to action
Overview
Erik Hougaard demonstrates an open source control add-in project for Business Central AL development. It addresses recurring problems with control add-ins: inconsistent height handling, keyboard input captured by the control, translating captions, and managing content such as HTML and SVG.
The video walks through the repository structure and code, including loading content and event handling. It also explains the user control host page type and the control ready event. Hougaard says the project may not be the world’s best yet, and that it is community-maintained and still evolving.
Key points
- Height control options include fill parent, fixed height, standard height and an offset, as an alternative to Microsoft’s inconsistent default height handling. The same options also work in fact boxes.
- Keyboard presses are routed through the control add-in so standard Business Central keys keep working when focus is in the control. The presenter treats this as an accessibility issue and says it takes a bit of hacking.
- Caption translation requires labels defined in AL and passed into the control add-in as a JSON object. The text then changes when the application language changes.
- Resources such as HTML, SVG, icons and text are streamed from the app into the control add-in instead of being embedded as strings. This requires a resource folder to be specified.
- The user control host page type has no page close event, so it risks data loss for editable content. The presenter considers it great for read-only scenarios. He thinks it was built mainly for Power BI and says he has raised his concerns with Microsoft.
- The on control ready event fires after page open, so developers cannot assume the control is ready when the page opens.
- The repository includes a skill document for creating new control add-ins, so AI agents such as Codex can use the repo as a template. JavaScript cannot be shared as a library across control add-ins, which is why a starter template approach is used.
Features
| Feature | Status | At |
|---|---|---|
| Flexible height control for control add-ins | status not stated, demoed | 1:53 |
| Keyboard input routing in control add-ins | status not stated, demoed | 4:36 |
| Caption translation support in control add-ins | status not stated, demoed | 6:08 |
| Resource streaming for control add-in content | status not stated, demoed | 6:55 |
| Starter kit with skill document for new control add-ins | status not stated, demoed | 7:21 |
| User control host page type limitation - no page close event | status not stated | 8:43 |
| Control ready event for initialization timing | status not stated, demoed | 10:02 |
AL objects mentioned
As heard in the captions. A name that matches one object page by exact type and name links to it; the others stay as named.
Not found in BC28-30: codeunit “caption code unit”, page “user control host”.
Quotes
- 1:53 “And the first thing is a more flexible of controlling the height of a controller then.”
- 5:25 “And and and for me this is very much an accessibility issue there’s nothing more annoying than suddenly you have to grab the mouse”
- 6:44 “So for in order for that to work, you have to have labels sitting in AL that is get passed into the controller then”
- 8:53 “the user control page user control host page type currently have an issue because there is no page close event.”
- 9:08 “So you’re if you have data in here and you want to save on exit and stuff like that, it it’s super easy for”
Disclaimers in the video
- 0:58 other: maybe this is not the world’s best control add-in yet, but it’s open source
- 9:18 other: So I have advocated my my concerns to Microsoft on this.
Presenters (as heard): Eric.
