Merge Dimensions By Codes in AX 2012???

Hi all,

Currently in the middle of upgrading to AX 2012 from 2009. In AX 2009 we use a static table method called Dimensions::mergeDimensionsByCodes. There is also a Dimensions::mergeDimensions which I can see has been refactored by Microsoft in 2012 as DimensionDefaultingService::mergeDefaultDimensions.

So my question is, is there a 2012 version of the Dimensions::mergeDimensionsByCodes? I can’t seem to find anything like it and I would prefer not to reinvent the wheel.

Thanks for any feedback.


Hi Bob,

The merge is possible in AX2012 with help of the class DimensionMerge. There is an example how to use on the table SalesLine, method ‘mergeDimension’.

Thanks for the reply André!! I took a look at the SalesLine.mergeDimension() method and depending on the parameters passed to it, it would either take the primary dimension over the secondary, or vice versa. In my case I would want the primary and this would produce the same result as the methods in question.

After reviewing the 2009 code a bit more I realized they call the mergeByCodes method in a way (the parms passed) that produces the same result as the standard merge. Also it was not being called anywhere else by custom code so I am now using the DimensionDefaultingService.serviceMergeDefaultDimensions() method in AX 2012 to merge the two dimensions. Since they didn’t utilize the ability to do other things in the mergeByCodes, I was able just to use the standard method of merging.

Thanks for your feedback!


Hi Bob,

When the answer helped you, can you mark it as verified? Then other people with a similar question can directly see that the question is answered.

Can somebody post code of merge in ax 2012??