Microsoft Dynamics AX 2012 Services ready!

Hi to all of you!

It has been a while since I have posted some useful content here. Mainly to the fact that I was focussing on getting the content in the book.

And now we can finally say that it is finished, reviewed and approved! So as we speak the presses are rolling to get it printed. All of you who have pre-ordered a copy, thanks for your patience, it will be rewarded 🙂

Book cover

Book cover

Dynamics Ax 2012 R2 VPC : new features?

Hi everyone, This is actually more a question that a post 🙂

Last week, I have downloaded the R2 virtual machine and fired it up to venture in the new capabilities of Dynamics AX 2012 R2. (And yes, shamefully I missed the Technical conference !)

Once the thing booted up, I could immediately  see that the model store was indeed separated from the data. I like!
But then I tried to look for a couple of other new features (like fe LINQ) but could not find any of them… ?!

Are most of the features already present in the virtual machine or have they been left out for now??? Any comments would be greatly appreciated!

Introducing Microsoft Dynamics AX 2012 Services!

Today I can finally present you my first book that is published : Microsoft Dynamics AX 2012 Services!

As you might have guessed by the title of the book, it covers everything there is to know about services within Dynamics AX 2012. This includes topics like the service architecture, WCF, document services, custom services , consuming web services, the SysOperation framework and much more. You can visit the Packt Publishing website for a more detailed description of the contents.

I have authored this book together with Klaas Deforche , a colleague and friend of mine . So my first thanks go out to him. Also, I want to thank the reviewers for providing their insights.

We are working hard to finalize the book, but it is already available for preorder. For those who are planning on getting a copy of it, preordering might be a good plan since there is a nice discount for preorders.

And as we are still finalizing the book, there is the opportunity for all of you to post your ideas or things you would like to see covered in the book. We might actually take it into account if possible.

Preorder here!


Ax 2012 and ETW (Event Tracing for Windows)

Now let’s get into to business quick and start off with a question : “How often did you want to reproduce / debug a certain process without actually knowing where the source of the problem may reside?”

Well the answer to that question for most of us will be : “Quite a lot” and then this would be followed immediately with the question : “Did you then create data log tables to store values, stack traces, information messages, …?” And again the answer will be often : “Yes”

Now this will probably help you out : ETW!

I will not go into the full details of Event Tracing for Windows as this would definately take us too far, but here’s a link where you can do some additional reading :

What we will look at for this post is how we can make advantage of ETW to do some tracing within Dynamics Ax 2012. Specifically we are going to make a custom piece of code do output some informational messages that can be caught by a data collector set using Perfmon and viewed by the Event viewer.

The following question may arise : “Why would we want ETW to handle the tracing and not stay in our habitat of X++ and storing data in tables?” Well the answer to this is:

  • ETW by far does not cause as many overhead as normal logging would do. Both for execution time (CPU) and diskspace.
  • If your code is ETW ready, you can do logging in production environments by starting / stopping data collector sets.
  • If your code is ETW ready, logging does not need to be built when needed but will immediately be available when needed.
  • The log files can be used in Event Viewers and also SCOM so it helps system administrators to know what is going on in the black box Dynamics Ax.

So let us jump in and create the data collector set.

First start op by opening perfmon and navigate to the user defined data collector sets.

Right click and create a new data collector set.



After the creation of the data collector set, right click it and you can start / stop the collection of ETW events.

But now that we have the collection part, we also need to make custom code trigger some events from within Dynamics Ax. And that is where the xClassTrace  class comes into play. The xClassTrace class is used to make advantage of ETW and is used to start / stop traces to files, log component messages in ETW to be caught by data collector sets, …

So let us take a look at some sample code that loops all customers and logs a component message in ETW to be caught. (Please not the isTracingEnabled checks to make sure string formatting will only be done when needed to have the minimum amount of performance overhead)

static void KeSae_ETW_LogComponentMessageTest(Args _args)
    CustTable   theCustomer;

        xClassTrace::logComponentMessage('AxTracing',"Starting ETW tracing");

    while select theCustomer
            xClassTrace::logComponentMessage('AxTracing',strFmt("Processing customer %1", theCustomer.AccountNum));

        xClassTrace::logComponentMessage('AxTracing',"Stopping ETW tracing");

Now that our code is ready to log some messages, start the data collector set in the perfmon tool and run the sample code. After running the code, go ahead and stop the data collector set. The result will be a log file generated that can be openened by the Event Viewer as seen below where we can actually see the logged messages from within Dynamics Ax.

So this is a very simple example, but this logging method is the way to go when you want efficient, performing logging in your system! This way you can minimize the logging overhead.

Dynamics Ax 2012 Technical conference : Day 1 : Part 1

This articles will be brief, because I don’t have much time between the sessions J

Yesterdag was the first day of the Dynamics Technical conference and following sessions were attended by me:

  • Programming model improvements Part 1 of 2
  • Programming model improvements Part 2 of 2
  • Developing in .NET managed code and X++ Enhancements
  • Solving the element ID problem

Programming model improvements Part 1 of 2

From this session, I remember the following additional features:

  • Table inheritance is added. So now you can have abstract tables which are then inherited by child tables.
    The unit of work pattern also comes into play here as there will be issues to address to manage transactions and code dealing with one ‘virtual record’ which may consist of multiple child tables. (Vehicle table with child tables bycicle, car, truck, …)
  • Next to normal X++ temporary tables, there is now also support for temporary tables in SQL Server
  • Date effective tables have been added. This means you can actualy filter records based on an ‘effective as of date’
  • Eventing has been added so now you can actually subscribe methods to events on other classes. Also, this is implemented by drag and drop so it is actually user friendly to do this.
  • The normal batch framework has been ‘adjusted / replaced’ with the SysOperation framework
  • The tree of linked tables are then linked by RecId, but you can actually have a key with fields specified in a field group to be used in the design when showing on what the linked was based
  • Tables have full text indes support now : This means they can be optimized for searches on text fields to look for certain words in the body.

Historical data pattern

This one is actually cool. Let’s say you have a historical table to contain a history of sales. Then you can set properties on the SalesTable datasource and the kernel will keep the history for you. So when you change values on the sales order for example, the kernel will create / update records in the historical data table.

Query ranges vs Query filters

When using joins (outer joins) the query ranges can produce incorrect outcomes. But now query filters are used to fix that. Instead of using the QueryRange object on the query, you can now also use QueryFilter objects and they are more optimized for SQL Server.

The other sessions will be describes in following posts as there is new session beginning right now J