How to remove value from default dimension in Dynamics AX 2012 Through X++
How to remove value from default dimension in Dynamics AX 2012 Through X++
static void removeValueDefaultDimension(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.removeDimensionAttributeValue(dimAttributeValue.RecId);
defaultDimension = dimStorage.save();
salesTable.DefaultDimension = defaultDimension;
salesTable.update();
ttsCommit;
}
Comments
Post a Comment