31 Jul. 2011

Dynamics AX 2012 Table inheritance & polymorphism

In the version pre-AX 2012 all tables in the AOT extended from the Common table so that all tables had the methods from the xRecord class and you could use an object of type Common as a polymorphic reference to any table in the AOT. All this still applies to AX 2012 but the notion of table inheritance now different. Here is the list of the new features in AX 2012:
  1. Field inheritance
  2. Method inheritance
  3. Method polymorphism
  4. Casting
  5. CUD support for the entire graph of tables in the hierarchy
The first 3 points are pretty self-explanatory, but things start to get interesting with point 4. Casting. Consider the following code fragment:

    DirPartyTable   dirPartyTable;
    DirPerson       dirPerson;
    dirPartyTable = dirPartyTable::find('7');
    if(dirPartyTable is DirPerson)
        DirPerson = dirPartyTable as DirPerson;

Note how the record is casted from type dirPartyTable to type DirPerson. Dynamics AX 2012 introduces 2 new X++ operators is and as. Here the is operator checks if the dirPartyTable object can be downcasted to its subtype dirPerson. The as operator is used to actually downcast the dirPartyTable object to the dirPerson subtype. So far this is similar to what we could achieve (with slightly more X++ code) with the previous versions of AX, but this is not just syntax-sugar. In AX 2012 when you select a record with select * from this means select all fields form all parent and child tables and this is fundamentally different from the previous versions of AX.

Now, let's consider point 5. CUD support for the entire graph of tables in the hierarchy

Obviously CUD here stands for Create, Update, and Delete and "support for the entire graph of tables in the hierarchy" means that all CUD operations are cascaded to all parent and child tables in inheritance hierarchy. For example in AX 2012 when you create a record in a child table the same record will be created in the parent table as well. When you delete a record from table, belonging to a table inheritance tree, the same record will be deleted from all child and parent tables in inheritance hierarchy. It is important to note that if a the cascade operation on a child or parent table fails then the entire transaction will be aborted.

30 Jul. 2011

Dynamics AX 2012 and BizTalk 2010 white papper

As you may know the BizTalk AIF adapter was removed in AX 2012.
Microsoft just published a white paper about the integration between AX 2012 and BizTalk 2010

Here is the link:
Using Microsoft BizTalk Server 2010 to Exchange Documents with Microsoft Dynamics AX

29 Jul. 2011

Form control type at run-time

This shows how to get the type of a form control at run-time. The code iterates through the controls in a field group and checks each control for it's type.

    FormControl fc;
    int         i;

    // ...
    for(i=1; i <= FieldGroupName.controlCount(); i++)
        fc = FieldGroupName.controlNum(i);
        if(SysDictClass::is(fc, classNum(FormStringControl)))
            info(strFmt("%1 %2", fc.name(), fc.type()));
If you do this in Dynamics AX 2012 you will get the following warning:

The SysDictClass::is method is obsolete. Use the IS operator instead.

The new syntax is:
if(fc is FormStringControl)

Looks better, don't you think?

28 Jul. 2011

Import customer address in the Global Address Book

In AX 2012 the GAB (Global Address Book) has gone through some serious changes and now the address information for the customers and vendors is kept in the LogisticsPostalAddress,and LogisticsPostalAddressExt tables. Additional information is maintained in the LogisticsAddress* tables.

This is the simplest possible example of how to create new customer and populate the customer's address information in AX 2012. Note that you may have to modify this code in order to handle the creation of records in the LogisticsAddress* tables.

        CustTable                       custTable;
        AccountNum                      accountNum = 'ABC-123';
        CustGroupId                     custGroupId = '10';
        Name                            name = 'ABC';
        DirParty                        dirParty;
        DirPartyPostalAddressView       dirPartyPostalAddressView;



        custTable.AccountNum = accountNum;
        custTable.CustGroup = custGroupId;

        custTable.insert(DirPartyType::Organization, name);

        dirParty = DirParty::constructFromCommon(custTable);

        dirPartyPostalAddressView.LocationName = 'ABC-AUTO';
        dirPartyPostalAddressView.City = 'London';
        dirPartyPostalAddressView.Street = 'Dover Street';
        dirPartyPostalAddressView.StreetNumber = '123';
        dirPartyPostalAddressView.CountryRegionId = 'GBR';



27 Jul. 2011

Installation warning with AX 2012 and SSRS

While installing the Reporting Services Extensions for the pre-release version of Dynamics AX 2012 the installation process finished with warning and the SSRS reports were not deployed. To deploy the reports I had to run the AxDeployReports.ps1 script located in C:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities directory. I order to be able to run the script from the file I had to run PowerShell with administrative privilege and then set the execution policy to bypass.

(click on the screenshot)

26 Jul. 2011

Dynamics AX 2012 is here

Dynamics AX 2012 is the next generation of business software by Microsft. The standard package includes the classic ERP  + CRM + Accounting offering + extended functionality for lean manufacturing, process manufacturing, environmental sustainability dashboard, public sector, etc. The product is localized and translated in more than 40 languages and that makes it suitable for all sorts and sizes of customers all over the world.

Integration and ease of deployment is another the key point. Dynamics AX is offered by the Microsoft's channel of  ISV and VAR partners. Different types of deployments are offered- from on-premise to cloud-computing. AX fits nicely with the rest of the products in the stack: Hyper-V,  SharePoint, Visual Studio, SQL Server (SSRS, SSAS), Project Server, MS Office, Terminal Services, Windows Server AD, etc. and
 makes a perfect match for companies that run on Exchange and Excel (are there any other).

The UI  feels pretty much like Office 2010. End-users will love the way in which the information is organized. If you feel like weightlifting all the power from the previous versions is still present, but the ribbon interface makes things so much easier. In addiction to that the new and enhanced Workflow functionality allows for modeling all sorts of business scenarios with almost no need for programming.

Obviously the MBS division has invested a lot of effort in order to get the job done and
the future looks bright for AX 2012.