Friday, October 12, 2012
In AX 2009, you might have a field that extends SysDim extended data type (EDT) that represents a single financial dimension value. Usually it goes together with dimension type, a field that extends SysDimension enum.
Such a configuration is helpful when you need a single dimension value of any type (Department, Cost Center and etc.). By selecting a type, you restrict dimensions to be filled in the SysDim field. It’s done by writing a custom lookup.
However in AX 2012, the financial dimensions data model was completely rebuilt using a different approach, and this approach does not allow for such a configuration anymore. In AX 2009 the data model was simple and self-explanatory.
AX 2012 dimensions are referenced using RecIds, which can be difficult to understand. It first references a dimension value set. This set links to one or more dimension value set items. It depends on how many dimension values are entered. For example, if only department and cost center are filled in then the set will contain only two set items. Set items link to dimension values. Dimension values link to dimension attributes (dimension types) and to actual values. Referencing actual values offers the possibility to use dimension values from many tables, like customers, items ant, etc. Values that were stored in Dimensions table in AX 2009 are moved to DimensionFinancialTag table in AX 2012.
SysDimension field upgrade is not a problem in AX 2012 as you can create a RecId field referencing to DimensionAttribute table. It has a Replacement Key, which shows nice values to a user. The problem is what decision to make when upgrading SysDim fields.
There are a couple of options:
- Create RecId field referencing DimensionAttributeValue table.
- Create DefaultDimension field referencing standard set of financial dimension values and disable those that are not supposed to be entered.
The first option might look promising but when it comes to displaying values on a form or a report, there is a drawback. DimensionAttributeValue table does not have a replacement key and so values on the field referencing to this table would be record id values, which means nothing to a user. In this case you have to create a field that would represent a value and make it as a replacement key. You have to make sure that a value is updated any time it is modified.
The second option is much better as it most closely reuses standard functionality. DefaultDimension field is created to show all dimensions values that are set up for the legal entity.
The advantage of this that you can reuse the DimensionDefaultingController class for controlling the behavior of the field and values entered. Follow the steps described in our whitepaper. Moreover, you can reuse this class method setEditability, which allows you to disable and enable dimension value fields at runtime. To setEditability method you have to pass a RecId of DimentionAttributeSet (not DimensionAttributeValueSet!). Below is the code for creating such DimensionAttributeSet if it does not exist. You pass a dimension attribute RecId and return RecId of DimensionAttributeSet
Here is an example of how to use the setEditability method. Overwrite your datasource’s (table that had SysDim method) method active on a form in AX 2012. This can be found in the dynamic editability setting. If you want it to be static, use init method on a form. Dynamic is handy when you have a dimension attribute field on a table as well.
Then on the form you should see something like the following:
Unfortunately, there is a small drawback; you can hide dimension value fields only at initialization and not at runtime. Despite that, it is still the best option so far.
These are the major steps for how to upgrade SysDim fields:
- Create Default Dimension field as described in the whitepaper “Implementing the Account and Financial Dimensions Framework for Microsoft Dynamics AX 2012 Applications”;
- Write data upgrade scripts for converting SysDim field value to DefaultDimension field;
- In forms, use DimensionDefaultingController class and its methods setEditability to disable dimension value fields that are not supposed to be entered.
Author of the post: our former AX Upgrade Team Manager Evaldas Landauskas.