How to Extract Default dimension in Ax 2012


Hi,
The below code is used to extract the default dimension in ax 2012.
(Pass the default dimension rec id in the job and get the result of filled fin.dimensoin attribute name and values)

http://yasirnedian.blogspot.ae/2014/04/get-default-financial-dimension-values.html
or
use the below job


static void DefaultDimensions_Extract(Args _args)
{

VendTable vendTable;

DimensionAttributeValueSet dimAttrValueSet;

DimensionAttributeValueSetItem dimAttrValueSetItem;

DimensionAttributeValue dimAttrValue;

DimensionAttribute dimAttr;

Common dimensionValueEntity;

;
 
// Find our supplier

//vendTable = VendTable::find('3008');

// Find the dimension value set that the vendor points to (for specifying the

// 'default' dimensions). This table is used as a sort of 'header' that the

// value set items (DimensionAttributeValueSetItem) records belong to.

dimAttrValueSet = DimensionAttributeValueSet::find(5637224079);//vendTable.DefaultDimension);


 
// Find all of the 'value set items' linked against the 'value set'
while select dimAttrValueSetItem
where dimAttrValueSetItem.DimensionAttributeValueSet == dimAttrValueSet.RecId
{// Find the dimension 'value' (DimensionAttributeValue) that the set item points to.
dimAttrValue = DimensionAttributeValue::find(dimAttrValueSetItem.DimensionAttributeValue);
// Find the underlying attribute.
dimAttr = DimensionAttribute::find(dimAttrValue.DimensionAttribute);

 
// Use the helper class to obtain a reference to the underlying entity (can be anything) 
dimensionValueEntity = DimensionDefaultingControllerBase::findBackingEntityInstance(
curext(),
dimAttr,  
dimAttrValue.EntityInstance);
 
info(dimAttr.Name + ' ' + dimAttrValue.getValue());
 
}
}

Comments

Popular posts from this blog

x++ code to Generate cheque for vendor payment journal

Import Procurement Hierarchy / Categories with out code in ax 2012

Copy favorites From one user to another user - Ax 2012