Business Central CDS Page Generator
Generates AL list page objects for CDS (Dataverse) tables with standard CRM integration patterns. Creates read-only list pages with coupling support, CreateFromCDS actions, and proper field visibility.
Prerequisites
- CDS table exists (TableType = CDS) in
src/Table/
- Available page ID (use Object ID Ninja or manual allocation)
- Understanding of which fields should be visible by default
- Author prefix defined (e.g., "BCS", "ABC", "XYZ") for consistent object naming
Quick Reference
Naming conventions:
- Page name:
"[PREFIX] CDS [EntityName]" (plural) — replace [PREFIX] with author prefix (e.g., "BCS CDS Countries")
- Page caption:
'Dataverse [EntityName]'
- File name:
[PREFIX]CDS[EntityName].Page.al — replace [PREFIX] (e.g., "BCSCDSCountries.Page.al")
- Entity variable:
CDS[Entity] (e.g., CDSCountry, CDSDepartment)
Note: The author's prefix in examples is "BCS". Replace with your own prefix throughout.
Standard properties:
PageType = List
Editable = false (CDS tables are read-only from BC)
RefreshOnActivate = true (refresh from Dataverse on page activation)
UsageCategory = Lists (makes page searchable)
Workflow
Step 1: Identify CDS Table and Prefix
Gather information:
- Author Prefix — your organization's prefix (e.g., "BCS", "ABC", "XYZ")
- CDS Table Name (e.g., "[PREFIX] CDS bcs_country")
- Entity Display Name (e.g., "Countries", "Departments")
- Primary Fields — which fields are most important (code, name, key identifiers)
- System Fields — standard fields that should be hidden (CreatedOn, ModifiedOn, statecode, statuscode, SystemId)
Step 2: Determine Page ID
Find next available page ID:
Get-ChildItem "src/Page/*.al" |
ForEach-Object {
$content = Get-Content $_.FullName -Raw
if ($content -match 'page\s+(\d+)') { [int]$matches[1] }
} | Sort-Object | Select-Object -Last 1
Next ID = Last ID + 1
Step 3: Generate Page Structure
Create the page file with:
- File path:
src/Page/[PREFIX]CDS[EntityName].Page.al (e.g., BCSCDSCountries.Page.al)
- Page properties — use standard CDS list page properties
- Layout — organize fields by visibility priority (see
references/field-layout.md)
- Actions — include CreateFromCDS action
- Triggers — add OnInit trigger
- Procedures — add SetCurrentlyCoupled[Entity] procedure
For complete code patterns and templates, read:
references/quick-start.md — quick start guide with workflows and troubleshooting
references/field-layout.md — field organization and visibility patterns
references/standard-components.md — actions, triggers, and procedures
references/examples.md — complete working examples
Step 4: Organize Fields
Field visibility rules:
- Visible (3-5 fields): Primary identifiers, names, key business fields
- Hidden (Visible = false): Technical fields, system fields, supplementary data
Standard field order:
- Primary identification fields
- Important business fields
- Additional business fields (hidden)
- System fields (all hidden): CreatedOn, ModifiedOn, statecode, statuscode, SystemId
Step 5: Add Standard Components
Required components:
CreateFromCDS action — creates BC records from selected Dataverse records
OnInit trigger — initializes CRM Integration Management
SetCurrentlyCoupled[Entity] procedure — tracks coupled record in lookup scenarios
See references/standard-components.md for complete implementations.
Step 6: Validate
Field Layout Principles
Primary fields (visible):
- Code/Number fields
- Name/Description fields
- Key classification fields
Hidden fields:
- GUIDs (except for debugging)
- Audit timestamps (CreatedOn, ModifiedOn)
- Status codes (statecode, statuscode)
- SystemId
ToolTip format:
- Start with "Specifies"
- Be specific about what the field represents
- End with period
Example: 'Specifies the two-letter ISO country code.'
Integration with Other Skills
| Skill |
Relationship |
| bc-dataverse-entity-generator |
Generate CDS table first, then create page |
| bc-dataverse-mapping-generator |
Page used in lookup procedures for coupling |
| bc-tooltip-manager |
Enhance tooltips after page generation |
| dataverse-schema-generator |
Reference schema docs for field selection |
Common Patterns
Master Data Pattern
For reference entities (Country, Currency, Legal Entity):
- Show code + name
- Show key attributes (ISO codes, classifications)
- Hide most other fields
Transactional Pattern
For transaction entities (Order, Invoice):
- Show document number + date
- Show party fields (customer, vendor)
- Show amount/status
- Hide line-level details
Standard CRM Entity Pattern
For OOB entities (Account, Contact, Product):
- Use base CRM table as SourceTable (e.g.,
"CRM Product")
- Follow same field visibility rules
- Adapt entity variable names
See EXAMPLES.md for complete implementations of each pattern.
Troubleshooting
| Issue |
Solution |
| Fields not found |
Verify field names match table exactly (case-sensitive) |
| Page doesn't display data |
Check RefreshOnActivate = true and OnInit trigger present |
| CreateFromCDS action fails |
Verify CRM Integration Management available and CDS connection configured |
| Compilation errors |
Update variable names to match entity (CDSCountry, CDSDepartment) |
Output Confirmation
CDS list page generated successfully!
Page: [ID] "BCS CDS [EntityName]"
File: src/Page/BCSCDS[EntityName].Page.al
Caption: Dataverse [EntityName]
Source: "BCS CDS [tablename]"
Visible fields: [count]
Hidden fields: [count]
Components included:
✓ CreateFromCDS action
✓ OnInit trigger
✓ SetCurrentlyCoupled[Entity] procedure
Next steps:
- Build project (Ctrl+Shift+P → AL: Build)
- Test page opens from Tell Me search
- Verify data displays from Dataverse connection
1---2name: bc-cds-page-generator3description: Automatically generate AL list page objects for CDS (Dataverse) tables with standard CRM integration patterns. Creates list pages with proper field layouts, CRM integration actions, coupling procedures, and initialization triggers. Use when user requests to create, generate, or build a list page for a CDS/Dataverse table, or mentions creating UI for Dataverse entities. Trigger phrases include "create page for CDS table", "generate list page for [entity]", "build Dataverse page", or when working with CDS integration tables that need user interfaces.4---56# Business Central CDS Page Generator78Generates AL list page objects for CDS (Dataverse) tables with standard CRM integration patterns. Creates read-only list pages with coupling support, CreateFromCDS actions, and proper field visibility.910## Prerequisites1112- CDS table exists (TableType = CDS) in `src/Table/`13- Available page ID (use Object ID Ninja or manual allocation)14- Understanding of which fields should be visible by default15- **Author prefix** defined (e.g., "BCS", "ABC", "XYZ") for consistent object naming1617## Quick Reference1819**Naming conventions:**20- Page name: `"[PREFIX] CDS [EntityName]"` (plural) — replace `[PREFIX]` with author prefix (e.g., "BCS CDS Countries")21- Page caption: `'Dataverse [EntityName]'`22- File name: `[PREFIX]CDS[EntityName].Page.al` — replace `[PREFIX]` (e.g., "BCSCDSCountries.Page.al")23- Entity variable: `CDS[Entity]` (e.g., `CDSCountry`, `CDSDepartment`)2425> **Note:** The author's prefix in examples is "BCS". Replace with your own prefix throughout.2627**Standard properties:**28- `PageType = List`29- `Editable = false` (CDS tables are read-only from BC)30- `RefreshOnActivate = true` (refresh from Dataverse on page activation)31- `UsageCategory = Lists` (makes page searchable)3233## Workflow3435### Step 1: Identify CDS Table and Prefix3637Gather information:381. **Author Prefix** — your organization's prefix (e.g., "BCS", "ABC", "XYZ")392. **CDS Table Name** (e.g., "[PREFIX] CDS bcs_country")403. **Entity Display Name** (e.g., "Countries", "Departments") 414. **Primary Fields** — which fields are most important (code, name, key identifiers)425. **System Fields** — standard fields that should be hidden (CreatedOn, ModifiedOn, statecode, statuscode, SystemId)4344### Step 2: Determine Page ID4546Find next available page ID:47```powershell48Get-ChildItem "src/Page/*.al" | 49 ForEach-Object { 50 $content = Get-Content $_.FullName -Raw51 if ($content -match 'page\s+(\d+)') { [int]$matches[1] }52 } | Sort-Object | Select-Object -Last 153```54Next ID = Last ID + 15556### Step 3: Generate Page Structure5758Create the page file with:591. **File path**: `src/Page/[PREFIX]CDS[EntityName].Page.al` (e.g., `BCSCDSCountries.Page.al`)602. **Page properties** — use standard CDS list page properties613. **Layout** — organize fields by visibility priority (see `references/field-layout.md`)624. **Actions** — include CreateFromCDS action635. **Triggers** — add OnInit trigger646. **Procedures** — add SetCurrentlyCoupled[Entity] procedure6566For complete code patterns and templates, read:67- `references/quick-start.md` — quick start guide with workflows and troubleshooting68- `references/field-layout.md` — field organization and visibility patterns69- `references/standard-components.md` — actions, triggers, and procedures70- `references/examples.md` — complete working examples7172### Step 4: Organize Fields7374**Field visibility rules:**751. **Visible** (3-5 fields): Primary identifiers, names, key business fields762. **Hidden** (Visible = false): Technical fields, system fields, supplementary data7778**Standard field order:**791. Primary identification fields802. Important business fields813. Additional business fields (hidden)824. System fields (all hidden): CreatedOn, ModifiedOn, statecode, statuscode, SystemId8384### Step 5: Add Standard Components8586**Required components:**87- `CreateFromCDS` action — creates BC records from selected Dataverse records88- `OnInit` trigger — initializes CRM Integration Management89- `SetCurrentlyCoupled[Entity]` procedure — tracks coupled record in lookup scenarios9091See `references/standard-components.md` for complete implementations.9293### Step 6: Validate9495- [ ] Page name follows `"[PREFIX] CDS [EntityName]"` pattern with your author prefix96- [ ] File name follows `[PREFIX]CDS[EntityName].Page.al` pattern97- [ ] Caption is `'Dataverse [EntityName]'`98- [ ] SourceTable references correct CDS table99- [ ] All field names match table definition (case-sensitive)100- [ ] ToolTips are meaningful101- [ ] CreateFromCDS action variable matches entity name102- [ ] SetCurrentlyCoupled procedure parameter matches entity name103- [ ] Page compiles without errors104105## Field Layout Principles106107**Primary fields (visible):**108- Code/Number fields109- Name/Description fields110- Key classification fields111112**Hidden fields:**113- GUIDs (except for debugging)114- Audit timestamps (CreatedOn, ModifiedOn)115- Status codes (statecode, statuscode)116- SystemId117118**ToolTip format:**119- Start with "Specifies"120- Be specific about what the field represents121- End with period122123Example: `'Specifies the two-letter ISO country code.'`124125## Integration with Other Skills126127| Skill | Relationship |128|-------|-------------|129| **bc-dataverse-entity-generator** | Generate CDS table first, then create page |130| **bc-dataverse-mapping-generator** | Page used in lookup procedures for coupling |131| **bc-tooltip-manager** | Enhance tooltips after page generation |132| **dataverse-schema-generator** | Reference schema docs for field selection |133134## Common Patterns135136### Master Data Pattern137For reference entities (Country, Currency, Legal Entity):138- Show code + name139- Show key attributes (ISO codes, classifications)140- Hide most other fields141142### Transactional Pattern 143For transaction entities (Order, Invoice):144- Show document number + date145- Show party fields (customer, vendor)146- Show amount/status147- Hide line-level details148149### Standard CRM Entity Pattern150For OOB entities (Account, Contact, Product):151- Use base CRM table as SourceTable (e.g., `"CRM Product"`)152- Follow same field visibility rules153- Adapt entity variable names154155See `EXAMPLES.md` for complete implementations of each pattern.156157## Troubleshooting158159| Issue | Solution |160|-------|----------|161| Fields not found | Verify field names match table exactly (case-sensitive) |162| Page doesn't display data | Check `RefreshOnActivate = true` and `OnInit` trigger present |163| CreateFromCDS action fails | Verify CRM Integration Management available and CDS connection configured |164| Compilation errors | Update variable names to match entity (CDSCountry, CDSDepartment) |165166## Output Confirmation167168```169CDS list page generated successfully!170171Page: [ID] "BCS CDS [EntityName]"172File: src/Page/BCSCDS[EntityName].Page.al173Caption: Dataverse [EntityName]174Source: "BCS CDS [tablename]"175176Visible fields: [count]177Hidden fields: [count]178179Components included:180✓ CreateFromCDS action181✓ OnInit trigger182✓ SetCurrentlyCoupled[Entity] procedure183184Next steps:185- Build project (Ctrl+Shift+P → AL: Build)186- Test page opens from Tell Me search187- Verify data displays from Dataverse connection188```