Inheritance form in AX 2012Continue reading
Creation of form based on inheritance tables without “Specifying type of new record” dialog box.
First of all we will need set of tables with inheritance applied. To do so follow the white paper provided my Microsoft:
When creating inheritance tables Microsoft Dynamics AX 2012 will add automatically relations to them but you might come across an error like this: “Duplicate relation name Organization detected in table inheritance.” This simply occurs as in both NoneProfitOrganization and GovernmentOrganization table Dynamics AX created relations with the same name in this case “Organization”. To resolve this issue simply rename one of the relations.
When all the tables with inheritance are set up we can move onto creating form.
In the white paper there is chapter about forms but it creates form where we need to use the dialog to select what type of record will be creating.
In this scenario we want Dynamics AX automatically detect where to create record depending what will be visible at the moment.
So let’s create from template SimpleList form and call it “Party”. Add the base “Party” table to data sources and save it.
You can see all the inheritance tables in the derived data sources:
Now we will want to be able to see fields from base table and fields tables rom each derived table.
So let’s add to the grid some of the fields from base table “Party” and from one of the derived e.g. “Person”. Now whenever we will want to add new record it will asks as what type should create:
Let’s create two record one type “Person” and other one type ”Government Organization” and see what has happened on the form some of the fields have been crossed out:
So every time we create different record we will only be able to access those fields that are assigned to it. So what if we want to only see fields assigned to specific type? Let’s change the form a little bit. We need to add our created enum to the top of the form and created grids for each table we will want to see. We will need to make the grid not visible and add some code so the form should look like this with properties:
New form method setControls():
Override init() method on form:
Override selectionChange() method on RelationType combo box:
Override clicked() method on both New and Delete buttons:
Now we can see only those fields which belongs to specific table according to selected type:
But still every time we create record we will still need to specify in which table plus derived data sources do not show inherited fields. To be able to see them we need to add the actual tables(so in our case “Person” and “GovernmentOrganization”) to forms data source and change property data source on grids to those tables(make sure all the fields specified previously are updated as well). So it should look like this:
No we can move swiftly between different tables and create record only in which is visible at the moment. We will not see as well the dialog for selecting the type as Microsoft Dynamics AX will be handling it now by picking what is set visible.
This provides us clean and easy functionality. The advantages are:
- We will not see any unnecessary fields (previously those were greyed out).
- Records visible are only those from selected type (previously we would see all records from based table).
- We can easily add more types by extending the inheritance.
The retail industry is still dealing with the effects of the pandemic that lasted almost three years. In addition to this, further global events are causing disruption to the supply chain or financial stability of many retailers globally. As the industry confronts new challenges shaped by economic and geopolitical factors, it also faces trends influenced by changing customer expectations and needs. Here are 5 developments and trends to watch.
An interactive, AI-powered support for sales, customer service, marketing, and supply chain - Microsoft Dynamics 365 Copilot leverages generative AI and natural language processing technology to perform simple, yet time-consuming daily tasks that workload employees but can be automated.
Every company management facing a system change wonders what steps should be taken to ensure that this change does not cause turbulence to its business. Identical dilemmas are faced by any IT company that provides services to implement a new system. I will focus on these dilemmas today.
Artificial intelligence (AI) and machine learning (ML) technologies are changing business every day - just as new tools and services are frequently emerging to expand their use cases. PwC estimates that the impact of these technologies on the global economy will add approximately $15.7 trillion to its value by 2030 (1).