What's Cooking in Business Central: Adding Resources to AL Applications
Adding resources (test data, sample data, configuration files, images) to Business Central AL extensions, using NAV App resource functions and a resourceFolders property in app.json. Covers size limits and access scope. Demo uses a recipe app and Business Central 25.2 or later.
- Introduction and Recipe Demo
- Understanding Resources in AL Code
- NAV App Resource Functions and Configuration
- Working with JSON and Blob Data
- Resource Limitations and Scope
- Resource Limits and Summary
Overview
The video shows how to package files inside an AL extension and read them at runtime. A recipe demo stores data in a table and displays it on a page, with the data coming from a JSON resource file. Resource folders are declared in app.json, and the NAV App functions read the files as resource, text, JSON, or blob data.
It also covers the limits. Resources are only accessible from the app that owns them, individual files and total size are capped, and resources are treated as code for source download policies. The presenter says the limits may change as usage data is collected.
Key points
- The speaker introduces the feature for Business Central 25.2 or later.
- app.json has a new resource folders property that takes an array, so several folders can hold resources.
- NAV App.Get Resource As Json reads a resource file as JSON; related functions are get Resource (for arbitrary content, e.g. read into an InStream), get Resource as text, and list resources.
- NAV App List Resources filters resources by a wildcard pattern or a folder such as images, and returns every resource available to the app if nothing is passed.
- Resources can only be accessed within the app that owns them, so a dependent app cannot read them.
- Limits: a single resource file can be up to 16 megabytes, total resource size must be under 256 per extension (unit not stated in the video), and at most 256 files. The presenter says these may change.
- Resources are treated as code: with allow downloading source enabled in resource exposure policies they are downloaded with the source code, and with it set to false they are not included.
Features
| Feature | Status | At |
|---|---|---|
| Resources in AL Extensions | status not stated, demoed | 0:05 |
| NAV App Get Resource As Json | status not stated, demoed | 1:38 |
| Resource Folders Configuration | status not stated, demoed | 2:39 |
| NAV App List Resources | status not stated, demoed | 3:20 |
| Resource Source Code Exposure Policies | status not stated | 4:48 |
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.
- table “Recipe data storage table” at 1:38
- page “Recipe display page” at 1:38
- other “recipe index Json” at 2:19
Not found in BC28-30: table “Recipe data storage table”, page “Recipe display page”.
Quotes
- 0:26 “if you are using business Central 25.2 or later um and to illustrate how this works uh let me show you I have this”
- 1:38 “the first thing here is this function nav app.get Resource as Json um and this is how we interact with resources”
- 2:39 “in the app. Json there is a new property called resource folders and you just specify whichever folder you want”
- 4:28 “resources can only be accessed within the app that owns them this means if I have another app that depends on this app I”
- 5:28 “any single resource file can be up to 16 megabytes the total size of all resource files has to be under 256 for a”
Disclaimers in the video
- 5:48 subject-to-change: we may change this as we collect uh data on usage just to optimize our system but this is what the limits are for now
