Dynamics Ax : Posting packing slip for a shipment X++

To post a packing slip in Dynamics Ax for a Shipment you can do the following :

void postPackingSlipForShipment()
{
    SalesFormLetter salesFormLetter;
    Set             shipmentsToPostSet = new Set(Types::String);
    ;

    shipmentsToPostSet.add(wmsShipmentCreated.shipmentId);

    salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);
    salesFormLetter.parmLibMkdShipmentId(this.parmLIBMKDShipmentSignOffLine().ShipmentId);
    salesFormLetter.parmWmsShipmentIdSet(shipmentsToPostSet);
    salesFormLetter.update(wmsShipmentCreated, systemDateGet(), SalesUpdate::PickingList, AccountOrder::Account);
}

Notice the parmWmsShipmentIdSet parameter.
This is the one actually making sure only the data for that shipments is selected. The parmShipmentId() method does not cut it here.

Leave a Reply

Your email address will not be published. Required fields are marked *