Create Default Dimensions using X++ code in AX 2012

In Dynamics AX, there are default dimensions usually made up of Department, Cost Center and other dimensions. At times when you are creating Sales Order or Purchase Order you create lines and each line has default dimensions. Those default dimensions are not so straight forward. They require some understanding. For example, I am sharing a screen shot of a Sales Order and the sales line having a default dimension just to show you how does it look like.

 

 

Now if you have to create default dimensions using X++ you will have to create DimensionAttributeValueSetStorage record. Here is the code for creating the default dimension. In my case, I needed cost center, department and product category. You can add as many dimensions in this method.

 

You can use the above code in a method or directly wherever you need to create default dimension.

Happy Daxing. Keep following me for AX technical stuff.

 

Abubaker Siddiq Shekhani

Abubaker Shekhani is an IT Entrepreneur and Full Stack Developer. He is the co-founder and the Developer behind Mytabeeb, a health care solution. He has worked for 5 years in Microsoft Dynamics AX space with Techno-functional role and glad to be one of few Microsoft Dynamics AX developers/consultants in Pakistan. He is TEDx speaker and likes to speak in public. He is an Amateur Astronomer and Astrophotographer. He is the founding member of Karachi Astronomers Society. He can be reached at me@abubakershekhani.com.

You may also like...