Dynamics AX Ledger Dimension using AxdDimensionUtil::getLedgerAccountId

27 Mar

The way ledger dimensions work changed drastically with the release of Dynamics AX 2012. You have probably seen the dynamic account strings, in which main account numbers are merged with ledger dimensions into one string. This is handled automatically by the user interface, but as a programmer you may have to do the same from code.

The underlying a structures are rather complex, but fortunately the utility class AxdDimensionUtil can help you with this. Assuming you have a main account ‘0001’, a dimension called “Branch” with a value of “031”, and a dimension called “Service centre” with a value of “Mumbai”, we needs to create a container with main account and all other required dimensions as Account entry pattern:

[‘MainAccountId’, ‘MainAccountId’, no. of dimensions, ‘DimensionName’, ‘DimensionValue’ , …]


dimensions = ['112050-AFS002', '0001', 2, 'Branch', 'AFS002', 'Service centre', 'Mumbai'];

AxdDimensionUtil::getLedgerAccountId takes container as parameter and creates and return ledger dimension.

the first element is actually the display value and second element is Main Account.The third element in the container is the number of dimensions, two in this case. Then the dimensions with ID followed by value.

Finally, you can pass the container to the AxdDimensionUtil::getLedgerAccountId method, which will return a ledger dimension record ID you can use as reference on the records where you need it, for example on ledger journal transactions:


The actual display of the merged account string is still handled by the user interface, but this method can help you create the underlying data without getting too gritty with the details.


Tags: , , , , , ,

One response to “Dynamics AX Ledger Dimension using AxdDimensionUtil::getLedgerAccountId

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: