10 Sep. 2011

Microsoft Dynamics AX 2012 White Paper: Developing Solutions in a Shared AOS Development Environment

This white paper outlines the development guidelines for Dynamics AX 2012 and how to setup and use version control with Team Foundation Server or MorphX VCS. The document provides guidance for developing solutions when multiple development clients are connected to a single shared AOS. With AX 2012 we have new additions to the development mix of tools and techniques like: Visual Studio clients, CIL run-time, SSRS Report Data Provider classes, etc.

I cannot stress enough on how important version control really is, especially in development environments with many programmers. Take a look at it:

Microsoft Dynamics AX 2012 White Paper: Developing Solutions in a Shared AOS Development Environment


9 Sep. 2011

Slipstream installation for Dynamics AX 2012

Slipstream installation is the process of installing of Dynamics AX 2012 + all the latest Cumulative Update at one go. With the previous versions of AX it was not recommended to do this. We had to install the vanilla AX from the installation image and then apply all the service packs and roll-ups. Now with AX 2012 you can extract the contents of the self-extracting file of the CU installer to the Update folder of the AX installer. Now when you start the AX installer all the updates will be applied automatically.

Here is the original article at EMEADAXSupport:

How can I slipstream Cumulative Updates for AX 2012 as part of a new installation

8 Sep. 2011

Date Effective tables with ValidTimeState and Dynamics AX 2012

You may have noticed the new ValidTimeStateFieldType property on tables in AX 2012. The enum values are None, Date and UtcDateTime. This is part of the new & cool Date Effective Table framework that comes with Dynamics AX 2012. The idea is to minimize the effort for managing period gaps, overlapping periods, period validation, etc. So, let's get down to how it works.
  • We create new table called DEV_ValidTimeState and we add new field named ItemId
  • We set the ValidTimeStateFieldType table property to UtcDateTime. At this point AX automatically creates 2 new fields: ValidFrom and ValidTo.   
  • Now we need to create new unique index, which should include the fields ItemId, ValidFrom, and ValidTo
  • We set the following index properties  
    • AllowDuplicates to No.
    • Alternate Key to Yes.
    • ValidTimeStateKey to Yes.
    • ValidTimeStateMode to Gap
  • Now let's insert some records.
  • static void createValidTimeState(Args _args)
        DEV_ValidTimeState table;
        delete_from table;
        table.ValidFrom = DateTimeUtil::newDateTime(1\1\2012, 0);
        table.ValidTo = DateTimeUtil::maxValue();
        table.ItemId = '1000';
        table.ValidFrom = DateTimeUtil::newDateTime(6\6\2012, 0);
        table.ValidTo = DateTimeUtil::maxValue();
        table.ItemId = '1001';
  • Here is how to select and update records from the table. Please note the use of the validTimeState keyword with select statements and there is a new xRecord method called validTimeStateUpdateMode.
  • static void updateValidTimeState(Args _args)
        DEV_ValidTimeState table;
        utcDateTime fromDateTime, toDateTime;
        fromDateTime = DateTimeUtil::newDateTime(3\3\2012, 0);
        toDateTime   = DateTimeUtil::maxValue();
        select validTimeState(fromDateTime) table;
        select validTimeState(fromDateTime) * from table;
        select validTimeState(fromDateTime) ItemId from table;
        select validTimeState(fromDateTime, toDateTime) ItemId from table;
        while select forUpdate validTimeState(fromDateTime) table
            table.ItemId = '1002';
  • The query framework was updated to support the new Time Effectiveness feature. Here is the code sample:
  • static void queryValidTimeState(Args _args)
        DEV_ValidTimeState      table;
        utcDateTime             fromDateTime, toDateTime;       
        Query                   q;
        QueryRun                qr;   
        QueryBuildDataSource    qbds;
        fromDateTime = DateTimeUtil::newDateTime(3\3\2012, 0);
        toDateTime   = DateTimeUtil::maxValue();
        q = new Query();    
        qbds = q.addDataSource(tableNum(DEV_ValidTimeState));
        qr = new QueryRun(q);
            table = qr.get(tableNum(DEV_ValidTimeState));

To sum up, in AX 2012 we have new feature that allows us to manage the time periods associated with an entity. We get all the benefits of validation and period gaps management for free (that's sweet). In order to support the new feature some changes have been introduced:
  • All tables now have new property called ValidTimeStateFieldType
  • Table indexes now have new properties
    • ValidTimeStateMode 
    • ValidTimeStateKey
    •  Alternate Key should be set to Yes
  • The kernel class xRecord and all tables now have the validTimeStateUpdateMode method. 
  • There is new system enum ValidTimeStateUpdate with the following values:
    • Correction – the ValidFrom or ValidTo values of existing rows must be modified to keep the date effective data valid after the update completes. 
    •  CreateNewTimePeriod – a new record is inserted into the table to maintain the validity of the date effective data after the update completes. 
    • EffectiveBased – forces the update process to switch to CreateNewTimePeriod for each row that spans the current date-time; otherwise to switch to Correction
  • The kernel class Query now has 4 new methods:

6 Sep. 2011

Dynamics AX Books

Dynamics AX: A Guide to Microsoft Axapta

This book is classic. It gives an overview of the product and its basic designs and frameworks.

Using Microsoft Dynamics AX 2009

This is excellent and up-to-date book on Dynamics AX. Highly recommended.

Managing Your Supply Chain using Microsoft Dynamics AX 2009

It's all about SCM. The book by manufacturing guru Scott Hamilton studies many different scenarios.

Technical books:

MORPHX IT, An introduction to Axapta X++ and the MorphX Development Suite

This is one of the first books on AX and X++ development. Highly recommended.

Inside Microsoft Dynamics® AX 2009

This is a must-read for every technical person starting up with X++ Dynamics AX as platform for development. After the release of this book for version 2009 Microsoft made available for free the book for version 4.0. You can download the pdf from here.

Microsoft Dynamics AX 2009 Programming: Getting Started

A well-written and gentle introduction to the world of X++ and Dynamics AX. Obviously if you have many years of experience with AX you will find less value in reading this book.

Microsoft Dynamics AX 2009 Development Cookbook

As the name suggests this book contains some recipes and boilerplate code to be adapted to your custom needs. If you struggle for hours to do something simple, well this is the book for you.

Quality Assurance for Dynamics AX-Based ERP Solutions: Verifying Dynamics AX customization to the Microsoft IBI Standards

An excellent book on quality assurance and best practices. Everybody should read this.

 Microsoft Dynamics AX 2009 Administration

With every new release the installation process of AX gets even more involved than the previous version. This book is good introduction to the most common configurations. If you are faced with a very complex scenario it's very likely that you wont find all the answers in this book.