Wednesday, July 29, 2020
Create Movement Journal using X++
Monday, July 27, 2020
How to read csv data from SFTP location through Microsoft Flow and Import into Dynamics 365 Finance and Operations
Create Purchase Order using X++
Sunday, July 26, 2020
Create Transfer Order using X++.
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventTransferId inventTransferId;
public void createTransferOrder()
{
ttsBegin;
createHeader();
createLine()
ttsCommit;
}
Sample code to create header of the Transfer Order
public void createHeader()
{
//create the transfer order id.
inventTransferId = InventTransferTable::numberSeq().num();
inventTransferTable.clear();
inventTransferTable.initValue();
inventTransferTable.TransferId = inventTransferId; // assign the transfer order id
inventTransferTable.InventLocationIdFrom = “FromWarehouse”;
inventTransferTable.InventLocationIdTo = “ToWarehouse”;
inventTransferTable.TransferStatus = InventTransferStatus::Created;
inventTransferTable.DlvModeId = “ShipMethod”;
inventTransferTable.ShipDate = “ShipDate”;
inventTransferTable.ReceiveDate = “ReceiveDate”;
inventTransferTable.AutoReservation = NoYes::No;
inventTransferTable.initToAddress();
inventTransferTable.initFromAddress();
inventTransferTable.InventLocationIdTransit = InventLocation::find(“FromWarehouse”).InventLocationIdTransit;
inventTransferTable.validateWrite();
inventTransferTable.insert();
}
public void createLine()
{
InventDim inventDim;
inventDim.clear();
inventTransferLine.clear();
inventDim =
inventTransferLine.inventDim();
inventDim.InventSiteId =
InventLocation::find(inventTransferTable.InventLocationIdFrom).InventSiteId;
inventDim.InventLocationId = inventTransferTable.InventLocationIdFrom;
inventTransferLine.initFromInventTransferTable(inventTransferTable,NoYes::Yes);
inventTransferLine.ItemId = “ItemId”;
inventTransferLine.LineNum = inventTransferLine::lastLineNum(inventTransferTable.TransferId) + 1;
inventTransferLine.initFromInventTable(InventTable::find(“ItemId”));
inventTransferLine.QtyTransfer = “Quantity”;
inventTransferLine.QtyRemainReceive = “Quantity”;
inventTransferLine.QtyRemainShip = “Quantity”;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
inventTransferLine.RemainStatus = InventTransferRemainStatus::Shipping;
inventTransferLine.AutoReservation = NoYes::No;
inventTransferLine.InventDimId =
InventDim::findOrCreate(inventDim).inventDimId;;
inventTransferLine.insert();
}