Recently, I got more interest in the ledger default dimensions in Microsoft Dynamics 365 for several reasons. At To-Increase, we are developing a new solution where we are looking beyond the standard provided features and there are some interesting questions around the security of the default dimensions.
This post will not elaborate on these two reasons, but I will explain step-by-step how to create or extend a table and form with ledger default dimension support.
Microsoft implemented a new data model and dimension framework as part of Microsoft Dynamics AX 2012. Functional, this framework was a relief for many companies as they could set up the financial dimensions without restrictions on the number of dimensions. Another benefit was that it did not require a developer to implement more than the standard three dimensions which we had until Microsoft Dynamics AX 2009.
The data model and working with dimension APIs was a shock for the existing AX developers (#XppGroupies). A lot of different tables do manage dimension attributes, values, and value sets. On a table, you can not directly see the dimension values. The default dimension field has a record ID reference to a dimension value set. With only this reference value, it is not known how many dimension attributes you have in the set and which values are set. True, it is more complex than an array field we had before, but we had to learn to use new APIs to get individual dimension values or change values using x++ coding. You can imagine a moment when I saw a developer banging his head against the wall…
A bit more easy was the implementation of the Default dimensions on forms. You had to create a special tab page for the Financial dimensions and place some default coding on several places on the form. This triggered the runtime creation of the default dimensions fields based on the setup.
Now with Dynamics 365 Finance and Operations, this coding is not required anymore. It is quite straight forward how to get a tab page with financial dimensions, but there are some things to know before you start.
Let me start by explaining the most simple part; development required on forms. This is assuming that you already have a field for the default dimensions on the table. (I will explain the table development below). For my demo, I created a very simple contract table and form.
When you have for example a details/master style form, you have to perform the next two steps:
- Add a new Tab Page for the default dimensions with the Pattern Dimension Entry Control and set values for at least the next properties:
Caption : The value @SYS101181 represents the label for Financial dimensions. It would be best practice to use this one, but depending on your solution you can choose another label.
Auto Declaration : On many default forms, the value is set to Yes, but this is not required for the default dimension visualization.
Name : Provide a meaningful name, so you and other developers would be able to recognize the control easily.
Needed Permission : When you want to be able to control when users will be able to interact with the financial dimensions or to secure these fields, the value can be set to Manual. In this case, you need to add form control permissions on your privilege. You can also have the default value None, but then you can’t secure these fields apart from other fields.
- Add a Dimension Entry control and fill the next properties:
Name : Like a similar property on the tab page, provide a meaningful name.
Caption : The value @SYS138487 is used for the label Default financial dimensions. Note that there might not be a lookup available. You can still type the value.
Data Source : Select the table from your data sources containing the default dimension field
Value Data Field : Select the default dimension field.
When you added these two controls, you can build the solution and test the results.
Productivity TipInstead of adding the controls manually, you can copy the tab page control from another form; e.g. the CustTable form. Then paste it on your form and change the Data Source and Value Data Field properties on the Dimension entry control which is also copied along with this copy and paste action. It would save you quite some time.
As you noticed, this did not require any x++ statements. All form controls and interactions are handled by the DimensionEntryControl class and other classes extending this control. Before moving over to the table development part, this class is set at value for the ControlClass property on the extended data type (EDT) DimensionDefault.
This property has been introduced in Dynamics 365 for Finance and Operations. Extended data types that do extend the DimensionDefault EDT are used to control the behavior of the dimension fields. You can learn more on Microsoft Docs: Default financial dimensions – Finance & Operations | Dynamics 365 and Uptake of Dimension Entry controls – Finance & Operations | Dynamics 365.
By writing about the EDT, this is a nice bridge to the table development. The last link provided above contains a list of extended data types that can be used for your tables to include the financial dimensions. When looking at the available EDTs and compare what has been used on e.g. the customers’ table, in my example, I need to add a new field based on the EDT LedgerDefaultDimensionValueSet. In addition, the table needs to have a foreign key relation to the DimensionAttributeValueSet table.
Note that your table should not be a global table, but should save data per company to be able to know which dimensions are active for the current company.
Again, we don’t need any x++ logic on the table. After adding the field and the relation, you can build the solution and you need to perform a database synchronization.
Productivity TipYou can drag and drop an EDT from the application explorer to the Fields node of your table. However, when doing this with the LedgerDefaultDimensionValueSet EDT or another useable EDT for the default dimension field, it will not automatically create the foreign key relation. It will actually create the correct foreign key relation when you drag and drop the DimensionDefault EDT to your table. After doing this, you can change the value of the property Extended Data Type to the desired EDT and adjust naming conventions.
I will now elaborate on the extended data types and some different behavior. When looking at the base DimensionDefault EDT and the extends, we have the next hierarchy to come to the EDT used in the example above:
DimensionDefault > LedgerDimensionValueSet > LedgerDefaultDimensionValueSet
However the first EDT has the ControllerClass property filled, you can’t use this one to use on your table field. The result is that no dimension fields are shown on the form. You can use the other two. The difference between these two EDTs is the text No default when no value is provided for a specific dimension for the last mentioned EDT. When you are using LedgerDimensionValueSet, the result will be like the next screenshot.
The Microsoft documentation provides a table in which EDT is linked to which exact controller class. There is not only a hierarchy on the EDT, but the controller classes do have the same hierarchy:
- LedgerDimensionEntryController extends DimensionEntryControl
- LedgerDefaultDimensionEntryController extends LedgerDimensionEntryController
As mentioned above, the only difference between the above mentioned controllers, based on the property, is the No default message.
You can also add the default dimensions on existing tables and forms using extensions. Similar to described above, you can add the default dimension field on a table extension and tab page control on a form extension. Taking the productivity tips into consideration, I was able to create a new project, table extension, and form extension in only 5 minutes!
The environment was already warmed up and after making the changes, I had to build the solution and synchronize the database and start testing. I did add the dimensions on the Warehouses table and form.
With only the default dimension available on the form, it will not do anything apart from being able to maintain the dimension values. The real development will now start to use it in your business logic. That will take the real time for fulfilling a certain business requirement.
I do hope you liked this post and will add value for you in your daily work as a professional. If you have related questions or feedback, don’t hesitate to use the Comment feature below.
That’s all for now. Till next time!