2 min read

Creating Financial Dimension Combinations in AX 2012

In AX 2012 there are a couple of different ways you can programmatically create combinations of dimensions.  These combinations are saved as records in the DimensionAttributeValueCombination table.  The RecId from the DimensionAttributeValueCombination table is what is saved in the LedgerDimension field on the LedgerJournalTrans table.

The first and best way to create dimension combinations is to use the class and method DimensionServiceProvider\buildDimensionStorageForLedgerAccount.  The buildDimensionStorageForLedgerAccount method takes a
LedgerAccountContract class.  In the LedgerAccountContract class there are two parm methods, parmMainAccount and parmValues.  The parmMainAccount method takes the MainAccount like ‘10060’ and the parmValues method takes a list of the other dimension values you want to set.  More specifically the parmValues method takes a list of classes.  The classes are of type DimensionAttributeValueContract.  On the DimensionAttributeValueContract class you set two
methods, parmName and parmValue.  For example, ‘Department’ for the name and ‘10’ for the value. Build up a list of DimensionAttributeValueContract classes for each dimension you want to specify and then pass the list to the parmValues method on the LedgerAccountContract class.  Once you have the LedgerAccountContract built up send it to the DimensionServiceProvider\buildDimensionStorageForLedgerAccount.


Optionally you can use a utility method in AX in AxdDimensionUtil\getLedgerAccountId.  This one is not as nice as buildDimensionStorageForLedgerAccount because it takes a container instead of a class (with known types).  Here’s an example of the method in AX:

container myContainer = [“110180-USAA”, “110180”, 1, “Country”, “USAA”];  //The third argument, 1, indicates the number of dimensions you are going to include, this does not include the main account.



Here is another example constructing the contents of the
container with the dimensions included in the demo data

    // Construct input

    dimensionValueIn =


        // Display value      
        strFmt(‘%1-%2-%3-%4’, ‘10060’, ’10’, ‘2020’, ‘M010’),

         // Main account


         // Segment count


         // 2nd segment of 1st hierarchy

        ‘Department’, ‘10’,


        // 3rd segment of 1st hierarchy

        ‘Center’, ‘2020’,

         // 4th segment of 1st hierarchy

        ‘Purpose’, ‘M010’


We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!