Friday, August 31, 2012

Wednesday, August 29, 2012

Inside Microsoft Dynamics AX 2012 available for pre-order

You can now pre-order the newest member of the Inside Microsoft Dynamics AX book series from Amazon.

It doesn't seem like it's comming in a Kindle edition, but one can only hope.

UPDATE November 22, 2012:
The book is in fact available for Kindle now. From O'Reilly you can get the book in several other e-Formats.

Thursday, August 9, 2012

Combining file paths

When I develop something where file paths or file names must be combined, I’m always in doubt how to make sure backslashes are in the right place.

The simple example is when you need to combine a file path with a filename. Should the path end with a backslash or not? Did the user enter the path with an ending backslash or not in e.g. the parameters for the job?

You end up either ignoring one scenario or adding code to figure both out. This could eventual be a method where you decide it always returns the path with the ending backslash.

Well, in .NET there’s a static method, System.IO.Path.Combine, taking care of all this. You just pass it a number of paths and it ensures that backslashes are in the proper places in the returned string.

Here's a small example in X++:
static void PathCombine(Args _args)
    str         path1 = @"C:\TestDir";
    str         path2 = @"C:\TestDir\";
    str         path3 = "MyFolder";
    str         combination;

    combination = System.IO.Path::Combine(path1, path3);

    info (strFmt("Combinig '%1' with '%2' gives '%3'", path1, path3, combination));
    combination = System.IO.Path::Combine(path2, path3);

    info (strFmt("Combinig '%1' with '%2' gives '%3'", path2, path3, combination));

Friday, August 3, 2012

Using Team Foundation Service with AX 2012

Microsoft is working on enabling Team Foundation Server as a cloud based service. You can try it out for free for the time being and you can even use it with AX 2012.

You can sign up for the service here:

In order to connect to the site from AX (and Visual Studio) you need to install the following:
  • Visual Studio 2010 SP1
  • KB2662296 for Visual Studio 2010 SP1
If AX is open when installing KB2662296, you'll need to restart it before configuring version control.

The address  for the Team Foundation Server to use for setup in AX is:

The rest of the setup in AX is the same as usual.

These sources made it possible for me to figure this out - thanks:

I haven't tried to use this from AX 2009, but I'd imagine that would work as well.

Wednesday, August 1, 2012

"View details" bug in collection letter and interest note forms

When you hit "View details" from the customer account number fields in one of the collection letter and interest note related fields, you'll open a form showing the customers open transactions and not the customer main data as expected.

The tables for collection letters and interest notes has two relations from their AccountNum fields; one for CustTable and one for CustTransOpen. For some reason AX chooses to base the view on the CustTransOpen relation.

You can fix this by adding the following code to the jumpRef method of the AccountNum field on the respective datasources:
public void jumpRef()
    // There are relations from the AccountNum field to both CustTable 
    // and CustTransOpen,
    // and AX chooses to use the CustTransOpen relations by default