Today, we see how to change the value of a default dimension of a record in D365FO using X++.
public LedgerDimensionValueSet updateDimension(LedgerDimensionValueSet _defaultDimension) { DimensionAttributeValue dimAttrValue; DimensionAttribute dimAttr; DimensionAttributeValueSetStorage dimensionAttributeValueSetStorage; LedgerDimensionValueSet defaultDimension; dimensionAttributeValueSetStorage = DimensionAttributeValueSetStorage::find(_defaultDimension); dimAttr = DimensionAttribute::findByName('DimensionName'); dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, 'DimensionValue', false, true);
if(dimAttrValue) { dimensionAttributeValueSetStorage.addItem(dimAttrValue); defaultDimension = dimensionAttributeValueSetStorage.save(); } return defaultDimension; }
Keep daxing!!
No comments:
Post a Comment