🧩 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”.
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- BC 29 lets a single index span base table and table extension fields — possibly related: both name Table 112 “Sales Invoice Header”
- BC Friday Tips #56 Understand Missing Fields in Copy Documents — possibly related: both name Table 112 “Sales Invoice Header”
- BC Friday Tips #74 Copy Document and Custom Field — possibly related: both name Table 112 “Sales Invoice Header”
- D365 Business Central: How to Fix Missing Sales Invoices in the API — possibly related: both name Table 112 “Sales Invoice Header”
- Dynamics 365 Business Central: “Hide Company Bank Account” setup in General Ledger Setup (Update Company Bank Account on posted documents) — possibly related: both name Table 112 “Sales Invoice Header”
- Dynamics 365 Business Central: Displaying Sales/Purchase Order No. in Item Ledger Entries (Source Order No. and Source Description) — possibly related: both name Table 112 “Sales Invoice Header”
- Dynamics 365 Business Central: How to check whether External Document No./Vendor Invoice No. are unique or duplicated – Customization — possibly related: both name Table 112 “Sales Invoice Header”
- Dynamics 365 Business Central: How to run a Report in Preview Mode without the Request Page (Hide Request Page) — possibly related: both name Table 112 “Sales Invoice Header”
- Dynamics 365 Business Central: Searches for duplicate external document numbers in sales documents and posted documents (Standard function/procedure) — possibly related: both name Table 112 “Sales Invoice Header”
- Leveraging RecordRef and FieldRef for Dynamic Coding — possibly related: both name Table 112 “Sales Invoice Header”
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.