Wednesday, December 11, 2013

Code to Get dimension description and value in ax 2012

This is hints of Code to Get dimension description and value in ax 2012. I have taken example of purchase order to show by selection first line of purchase line dimension value and description.

 PurchLine _purchLine;  
 DimensionValue _Dimvalue;  
 Description _Dimdesc;  
 ;  
 select firstonly _purchLine;  
 _Dimvalue= dimValue(_purchLine.DefaultDimension, 'Department');  
 _Dimdesc = dimDesc(s_purchLine.DefaultDimension, 'Department');  
 info(strfmt("%1: %2", _Dimvalue, _Dimdesc));