al-object-id-allocator
Allocate the next available Business Central AL object ID/number by scanning .al files and idRanges in app.json using the bundled PowerShell script. Use when creating new tables/pages/codeunits/extensions and you need a free object number.
When & Why to Use This Skill
The AL Object ID Allocator is a specialized utility designed for Microsoft Dynamics 365 Business Central developers to automate the management of object IDs. By scanning project configurations and existing source files, it intelligently identifies the next available ID within defined ranges, eliminating manual tracking errors and streamlining the development of extensions, tables, and pages.
Use Cases
- New Object Creation: Automatically fetch a valid, unused ID when creating new AL objects like tables, pages, or codeunits to ensure compliance with app.json ranges.
- Conflict Resolution: Prevent ID collisions in collaborative environments by scanning the latest codebase to find the smallest available gap in the ID sequence.
- CI/CD Pipeline Integration: Use the PowerShell script within automated workflows to dynamically assign IDs for auto-generated boilerplate code or extensions.
- Project Auditing: Quickly verify the current state of ID usage across a large Business Central project to maintain organized development standards.
| name | al-object-id-allocator |
|---|---|
| description | Allocate the next available Business Central AL object ID/number by scanning .al files and idRanges in app.json using the bundled PowerShell script. Use when creating new tables/pages/codeunits/extensions and you need a free object number. |
AL Object ID Allocator
Allocate the next available AL object number using scripts/Get-NextALObjectNumber.ps1.
Usage
pwsh -File "<skill-folder>\scripts\Get-NextALObjectNumber.ps1" -AppPath "<AL_APP_FOLDER>" -ObjectType "<type>"
Common patterns:
pwsh -File ".\.claude\skills\al-object-id-allocator\scripts\Get-NextALObjectNumber.ps1" -AppPath ".\app" -ObjectType "table"pwsh -File ".\.claude\skills\al-object-id-allocator\scripts\Get-NextALObjectNumber.ps1" -AppPath ".\test" -ObjectType "codeunit"
Supported object types
table, page, codeunit, report, query, xmlport, enum, interface, controladdin, pageextension, tableextension, enumextension, reportextension, permissionset, entitlement, profile, pagecustomization
Output and errors
- On success, the script writes a single integer (the allocated number) to stdout and exits with code
0. - On error, it writes
ERROR-XXX: <message>to stderr and exits with code1.
Tip: Capture the result in PowerShell:
$nextNumber = & "<skill-folder>\scripts\Get-NextALObjectNumber.ps1" -AppPath "<AL_APP_FOLDER>" -ObjectType "page"
What it does (high level)
- Reads
idRangesfrom<AppPath>\app.json - Scans
<AppPath>\**\*.alfor existing objects of the requested type - Ignores commented-out declarations
- Returns the smallest available number within the allowed ranges (fills gaps first)