How to update default dimension in Dynamics AX 2012 Through X++
How to update default dimension in Dynamics AX 2012 Through X++
static void updateDefaultDimension(Args _args)
{
DimensionAttributeValueSetStorage dimStorage;
DimensionAttribute dimAttr;
DimensionAttributeValue dimAttributeValue;
DimensionDefault defaultDimension;
SalesTable salesTable = SalesTable::find('1000210',true);
ttsBegin;
dimStorage = DimensionAttributeValueSetStorage::find(salesTable.DefaultDimension);
dimAttr = DimensionAttribute::findByName("Dimension name");
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, "1555" , true, true);
dimStorage.addItem(dimAttributeValue);
defaultDimension = dimStorage.save();
salesTable.DefaultDimension = defaultDimension;
salesTable.update();
ttsCommit;
}
Comments
Post a Comment