Microsoft Dynamics 365 Blog

We have received extensive feedback on previous blog postings about the outbound processes within Inventory management in Microsoft Dynamics AX. Many readers have requested information on how to interact with Microsoft Dynamics AX via .NET Business Connector to create picking operations.

With this technical posting we will try to demonstrate how easy it is to code a terminal solution in C# .NET and call simple picking update methods in Microsoft Dynamics AX.

The solution is coded by using Microsoft.Dynamics.BusinessConnectorNet;

You will need a reference in the project to run the example code.

HINT: Get more information about the .NET Business Connector at MSDN (Microsoft Dynamics AX Developer Center)

This small Microsoft Visual Studio project includes information about:

How to log on to an AX installation

// company name, language, object server, configuration            
// this uses Windows Authentication
ax.Logon(CompanyId, null, null, null);

How to read data from AX and insert the data in a grid on a Windows form


View picking routes in the upper pane and picking lines in the lower pane.

How to prepare data and call picking update functions from the .NET C# code

Picking in AX: In AX you can pick multiple lines by calling the WMSOrderTrans::finishPickingLinesMulti method. This method takes a packed AX Map where the key is the recId of the wmsOrdertrans to be picked and the value is an AX container with the OrderId and recVersion.

The example shows how to prepare the map and call the method to do the pick.

private AxaptaObject BuildAxaptaMapForWMSPickingLines()
//build a map of the following structure
//key is <c>WMSOrderTrans.recId</c> and whose value
//is [WMSOrderTrans.OrderId,WMSOrderTrans.recVersion].

AxaptaObject axMap = ax.CreateAxaptaObject(“Map”, (int)Types.Int64,(int)Types.Container);

foreach (DataGridViewRow dgvRow in wmsOrderTransGrid.SelectedRows)
AxaptaContainer axContainerWMSPair = ax.CreateAxaptaContainer();
DataRow row = null;
DataRowView drv = (DataRowView)dgvRow.DataBoundItem;
row = drv.Row;

axContainerWMSPair.Add(row.Field<string>(1)); //orderid
axContainerWMSPair.Add(row.Field<Int32>(7)); //recversion

//add to axapta map
row.Field<Int64>(6), axContainerWMSPair);
return axMap;

private void PickSelectedLinesFromMap(AxaptaObject axaptaObjectMap)
// call below takes a packed map whose key is
// <c>WMSOrderTrans.recId</c> and whose value is

// <c>WMSOrderTrans.OrderId,WMSOrderTrans.recVersion</c>.


Apart from the method to multi-update picking lines the project also includes a method to pick-update multiple picking routes by calling WMSPickingRoute::finishMulti.

private void PickSelectedRoutesFromList(AxaptaObject axList)

Have fun trying this yourself!

Bibi Christensen, Alexander Malafeev, Per Lykke Lynnerup & Lennart Conrad

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!