This post is machine-translated. The original post in german language can be found here.
These post applies to following version:
Dynamics AX 2012
Dynamics AX 2012
This post is part of the series »Dynamics AX 2012 - Financial dimensions«
In Dynamics AX 2012, the handling of financial dimensions has changed. Both on the surface and the underlying data model.
In earlier versions you find one field - usually named dimension - of type array. Now you'll find a field derived from RecId called DefaultDimension (or similar).
In this series I want to specifically address these changes and present one or the other piece of code.
|
|
|
|
|
|
Sometimes you have the requirement that a certain financial dimension is to be set on the basis of an input in a form.
The following code example is something relatively easy to implement. In the example, whenever a particular field is changed - queried on the method modified() of the field of a DataSource, the financial dimension Costcenter will be filled with the value 25. If the value to be entered an invalid, nothing happens (error message or similar).
public void modified() { DimensionAttribute DimensionAttribute = DimensionAttribute::findByName("Costcenter"); DimensionValue newValue = '25'; // New dimension value super(); dimensionDefaultingController.setDimensionAttributeValue( DimensionAttribute, DimensionAttributeValue::findByDimensionAttributeAndValue(DimensionAttribute, newValue).RecId, newValue); }In the example, an existing instance of DimensionDefaultingController used.