Shared posts

26 Aug 21:52

AIF – How to get a better error message and stack trace for a failed document?

by cocochambo .

How many times when working with AIF you got an error and have no idea what caused the issue. The document fails for many reasons and what you get is a very generic error message. Debugging AIF is a painful process and time consuming. Below is the trick that we can find out more descriptive error message and even a stack trace.



Run the job below and replace the GUID with the GUID from the document that failed

static void TestOutboundMessage(Args _args)
    guid id = str2guid("{BCE9B13D-3F3C-497F-A566-55606C3F19B4}");
    AifQueueManager document;

    select firstOnly document where document.MessageId == id;

    // This static method is declared as private and this trick is to avoid changing the access specifier on the class
    new SysDictClass(classNum(AifOutboundProcessingService)).callStatic('processAsUser', [document.MessageId]);


Refresh and review the error again, you will see a more descriptive message and a stack trace that can save your life.


06 May 18:48

AX 2012 R2 – Where is the picking lines created ?

by Kurt Hatlevik

In R2 there are several steps and places that picking routes/Picking lines are created, depending if you have an order-based picking or consolidated picking.

The fundamental element for a picking route is output orders, that acts as the basis.

And Output orders are created through the class\WMSOrderCreate:


As soon as the WMSOrder is created, it can try to attach itself to a shipment (consolidated scenario)(Also WMSOrderCreate)


If you follow the trace in the wmsOrder.autoAddShipment() you will get to the code where the WMSOrderTrans is created.

WMSOrderTrans is created here


And here :


The final step is the creation of the WMSPickingRoute, that happens in the shipment reservation.  And inside this method you will also find the creation process for the picking route.


So the sequence and steps for creating a picking route is the following :

1. WMSOrder is created

2. WMSShipment is created

3. WMSOrderTrans is created

4. WMSPickingroute is created

Also remember that the structure of shipmentId, PickingrouteID’s is very loose entities, and is not strongly anchored to inventTrans. So it is possible to move wmsorderTrans transactions between pickingroute and shipments quite easily by using X++.


Happy DAX’ing