Thursday, January 28, 2010

Important limitation in Enterprise Portal deployment

You cannot out of the box run multiple EP sites, with different versions of User Control code, on the same IIS.

This is because SharePoint expects the code to be under the %System drive%:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\ep folder and you cannot deploy to different folders.

A workaround where you map the layout folder differently for each site, is described in KB944105. But it has some conequences, which you can read more about in the knowledgebase article.

Friday, January 22, 2010

Create a base64 encoded string from an image in AX

Here's how you can create a base64 encoded string from an image in AX:

static void Job4(Args _args)
    System.Drawing.Image     image;
    Str                      string;
    System.IO.MemoryStream   memoryStream;

    // Load the file
    image = System.Drawing.Image::FromFile(@"C:\sandbox\test.tif");

    // Convert the file to a memory stream
    memoryStream = new System.IO.MemoryStream();
    image.Save(memoryStream, System.Drawing.Imaging.ImageFormat::get_Tiff());

    // Create the base64 encoded string
    string = System.Convert::ToBase64String(memoryStream.ToArray());

    // Save it again, to a new image (just for fun or test if you want)
    AifUtil::saveBase64ToFile(@"C:\sandbox\test1.tif", string);

Convert an image from one format to another from AX

Here's is how you can convert an image from one format to another:

static void Job5(Args _args)
    System.Drawing.Image    image;

    image = System.Drawing.Image::FromFile(@"C:\sandbox\test.tif");

    image.Save(@"C:\sandbox\newtest.jpg", System.Drawing.Imaging.ImageFormat::get_Jpeg());

The new files tend to be a bit larger. You have to work with the ImageCodecInfo class from .NET to fix this.

Thursday, January 21, 2010

Annoying bug in AX 2009 Intercompany Sales Order

Here is a really annoying bug in AX 2009 intercompany sales order, causing errors where it can take you ages to figure out the cause.

When adding items to an older intercompany order, the intercompany chain is not started. The user needs to pay much attention to realize that the chain is not started and there is not easy way to start it, once the sales order lines is saved.

Repro steps:
Go to company CEE.
Create a new sales order (customer should not be important, but use for example 1102).
Go to the "Other" tab of the sales order header, and check the "Autocreate intercompany orders" check box.
Go to the "Delivery" date tab page.
Enter values for Confirmed Receipt and Confirmed Shipping Dates.
Add an item line for item 1101.
Move the cursor away from the sales order.
At this point the system will generate the intercompany.

Now change the sessions date to a date after the Confirmed Shipping date of the order.

Go back to the order.
Add one more line for 1101.
When saving the record you should get a warning like this: "Item number 1101, requested shipping date 12/3/2009 is in the past.".
The order line is now saved.
Move the cursor away from the sales order.
Nothing happens - the intercompany order has not been updated with the new order line and I see no way that I can trigger the system to generate the line, other than changing dates of the order, delete and recreate the line..

Business impact:
The first problem is that if users aren't paying proper attention to this warning, they'll never get the intercompany chain started on order. And they will not know about it, until they realize that the items aren't delivered.
The second problem is that there is no way to change the dates and the get the intercompany chain started, unless you delete the sales order line and recreated. If you use the product builder to configure items for the sales order, this could be a bit of a pain to do.

Microsoft is considering fixing this issue for AX 2011, but sees it as a matter of educating the users...