🧩 Deriving dimensions in Business Central beyond Default Dimensions
The OnAfterGetRecDefaultDimIDProcedure integration event in the DimensionManagement codeunit fires after Business Central calculates default dimensions, allowing you to extend or modify dimension sets with custom logic. This approach demonstrates five scenarios: deriving dimensions from document fields, other dimensions, related tables, historical data, and overriding with higher-priority rules.

post Gerardo Rentería Blog
"La idea es sencilla: primero preparas en memoria lo que quieres cambiar, luego lo aplicas de golpe sobre el set real."
Key points
- Hook into OnAfterGetRecDefaultDimIDProcedure to extend default dimensions without modifying standard code
- Use two helper procedures: StageDim to prepare dimensions in a temporary buffer and CommitStagedDims to merge them into the document’s dimension set
- Derive dimensions from multiple sources: document fields, already-calculated dimensions, related table lookups, and historical customer data
- Force dimension recalculation by subscribing to field OnAfterValidateEvent when Business Central doesn’t automatically recalculate
- Override previously derived dimensions with higher-priority rules in the same event to implement conditional logic
Quotes
- “La idea es sencilla: primero preparas en memoria lo que quieres cambiar, luego lo aplicas de golpe sobre el set real.” (Describes the two-step pattern (StageDim then CommitStagedDims) that avoids repeating logic across scenarios)
AL objects mentioned
As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.
- codeunit 408 “DimensionManagement”
- codeunit “GDRGCustomerDimSubs”
- codeunit “GDRGDerivedDimMgt”
- table 36 “Sales Header”
- table “Dimension Set Entry”
- table 13 “Salesperson/Purchaser”
- table 112 “Sales Invoice Header”
Not found in BC28-30: codeunit “GDRGCustomerDimSubs”, codeunit “GDRGDerivedDimMgt”.
More than one object has this name, so none is linked: table “Dimension Set Entry”.
Context
- Features: dimension derivation, integration events, default dimensions, dimension set modification, custom dimension logic, dimension recalculation triggering, dimension override rules
Source: Gerardo Renteria, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.