AL ID Manager
This skill provides instructions for requesting next available IDs from the AL ID Manager service when creating new AL objects, table fields, or enum values.
Prerequisites
Before requesting an ID, you must read the project's app.json to obtain:
- •
id- The application identifier (used asappIdin API calls) - •
idRanges- Array of allowed ID ranges withfromandtovalues
Configuration
Before using this skill, you must set up your API credentials.
Config File Location
| Platform | Path |
|---|---|
| macOS/Linux | ~/.al-id-manager/config.json |
| Windows | %USERPROFILE%\.al-id-manager\config.json |
Setup Instructions
- •Check if config exists - Read the config file from the appropriate path
- •If missing, create it - Create the directory and file with this template:
{
"apiKey": "your-api-key-here",
"baseUrl": "https://al-id-manager.npretail.io"
}
- •Replace
your-api-key-herewith your actual API key from your administrator
Environment Variable Override
You can override the config file by setting the AL_ID_MANAGER_API_KEY environment variable:
- •macOS/Linux:
export AL_ID_MANAGER_API_KEY="your-key" - •Windows:
set AL_ID_MANAGER_API_KEY=your-key
Precedence: Environment variable > Config file > Error (no default)
Security Warning
⚠️ The API key is passed as a query parameter (?key=...). Query parameters may be logged by proxies, browsers, or monitoring tools. Treat API keys as sensitive credentials.
API Usage
Base URL: Read from config baseUrl field (default: https://al-id-manager.npretail.io)
All requests must include:
- •Header:
Content-Type: application/json - •Query parameter:
?key={apiKey}(from config or environment variable)
Endpoints
1. Get Next Object ID
Use when creating a new AL object (table, page, codeunit, report, etc.).
Endpoint: POST /api/object/next/{appId}?key={apiKey}
Request Body:
{
"type": "<object-type>",
"ranges": [
{ "from": 50000, "to": 99999 }
]
}
Supported Object Types:
table, page, codeunit, report, query, xmlport, enum, enumextension, tableextension, pageextension, reportextension, interface, permissionset, permissionsetextension, entitlement, controladdin, profile, pagecustomization, dotnet, requestpage
Example (curl):
curl -X POST "https://al-id-manager.npretail.io/api/object/next/your-app-id?key={apiKey}" \
-H "Content-Type: application/json" \
-d '{"type": "table", "ranges": [{"from": 50000, "to": 99999}]}'
Replace {apiKey} with value from config file or environment variable
2. Get Next Table Field ID
Use when adding a new field to a table object.
Endpoint: POST /api/table/next/{appId}?key={apiKey}
Request Body:
{
"tableId": 50100,
"ranges": [
{ "from": 1, "to": 999999 }
]
}
Note: For table fields, use the default range [{"from": 1, "to": 999999}] unless your organization has specific field ID policies.
Example (curl):
curl -X POST "https://al-id-manager.npretail.io/api/table/next/your-app-id?key={apiKey}" \
-H "Content-Type: application/json" \
-d '{"tableId": 50100, "ranges": [{"from": 1, "to": 999999}]}'
Replace {apiKey} with value from config file or environment variable
3. Get Next TableExtension Field ID
Use when adding a new field to a tableextension object.
Endpoint: POST /api/tableextension/next/{appId}?key={apiKey}
Request Body:
{
"tableextensionId": 50100,
"ranges": [
{ "from": 50000, "to": 99999 }
]
}
Note: For tableextension fields, use idRanges from app.json (not the default 1-999999 range).
Example (curl):
curl -X POST "https://al-id-manager.npretail.io/api/tableextension/next/your-app-id?key={apiKey}" \
-H "Content-Type: application/json" \
-d '{"tableextensionId": 50100, "ranges": [{"from": 50000, "to": 99999}]}'
Replace {apiKey} with value from config file or environment variable
4. Get Next Enum Value ID
Use when adding a new value to an enum object.
Endpoint: POST /api/enum/next/{appId}?key={apiKey}
Request Body:
{
"enumId": 50100,
"ranges": [
{ "from": 1, "to": 999999 }
]
}
Note: For enum values, use the default range [{"from": 1, "to": 999999}] unless your organization has specific value ID policies.
Example (curl):
curl -X POST "https://al-id-manager.npretail.io/api/enum/next/your-app-id?key={apiKey}" \
-H "Content-Type: application/json" \
-d '{"enumId": 50100, "ranges": [{"from": 1, "to": 999999}]}'
Replace {apiKey} with value from config file or environment variable
5. Get Next EnumExtension Value ID
Use when adding a new value to an enumextension object.
Endpoint: POST /api/enumextension/next/{appId}?key={apiKey}
Request Body:
{
"enumextensionId": 50100,
"ranges": [
{ "from": 50000, "to": 99999 }
]
}
Note: For enumextension values, use idRanges from app.json (not the default 1-999999 range).
Example (curl):
curl -X POST "https://al-id-manager.npretail.io/api/enumextension/next/your-app-id?key={apiKey}" \
-H "Content-Type: application/json" \
-d '{"enumextensionId": 50100, "ranges": [{"from": 50000, "to": 99999}]}'
Replace {apiKey} with value from config file or environment variable
Response Format
All endpoints return:
{
"id": 50100,
"available": true
}
- •
id- The allocated ID to use - •
available- Whether an ID was successfully allocated
If no ID is available in the given ranges:
{
"id": 0,
"available": false
}
Workflow
- •Read app.json to get
idandidRanges - •Determine the ID type based on what you're creating:
- •New AL object → use object endpoint with matching
type - •New table field → use table endpoint with
tableId - •New tableextension field → use tableextension endpoint with
tableextensionId - •New enum value → use enum endpoint with
enumId - •New enumextension value → use enumextension endpoint with
enumextensionId
- •New AL object → use object endpoint with matching
- •Make the API request with appropriate ranges:
- •Objects, tableextensions, enumextensions: use
idRangesfrom app.json - •Table fields, enum values: use
[{"from": 1, "to": 999999}]
- •Objects, tableextensions, enumextensions: use
- •Use the returned ID in your AL code
Range Selection
| Creating | Range Source |
|---|---|
| AL Object (table, page, codeunit, etc.) | idRanges from app.json |
| Table field | [{"from": 1, "to": 999999}] |
| TableExtension field | idRanges from app.json |
| Enum value | [{"from": 1, "to": 999999}] |
| EnumExtension value | idRanges from app.json |
Error Handling
If the API returns an error or available: false:
- •Check that the
appIdmatches theidin app.json - •Verify the ranges are valid (positive integers,
from<=to) - •Ensure you haven't exhausted all IDs in the given ranges