Status stat = nss.login(p).status;
if (stat.isSuccess)
{
// Location ID 1 = California
RecordRef rfa = new RecordRef();
rfa.internalId = "1";
RecordRef rfb = new RecordRef();
rfb.internalId = "2";
// Employee ID = 3 John Doe
RecordRef emp = new RecordRef();
emp.internalId = "3";
// Item ID = 6
RecordRef item = new RecordRef();
item.internalId = "6";
// Creating an array of Transfer Order Items
TransferOrderItem[] toi = new TransferOrderItem[1];
//Populating the TransferOrderItem object with the fields in the sublist
TransferOrderItem toi1 = new TransferOrderItem();
toi1.item = item;
toi1.quantity = 20;
toi1.quantitySpecified = true;
toi1.amountSpecified = true;
toi1.amount = 54.99;
toi1.commitInventory = TransferOrderItemCommitInventory._availableQty;
toi1.commitInventorySpecified = true;
// Assigning the Transfer Order Object to the array.
toi[0] = toi1;
// Assigning the array of Transfer Order Items to the Transfer Order Item List.
TransferOrderItemList toil = new TransferOrderItemList();
toil.item = toi;
// Creating the Transfer Order object and appending fields to the object.
TransferOrder to = new TransferOrder();
to.tranDate = System.DateTime.Now;
to.location = rfa;
to.transferLocation = rfb;
// Assigning the employee and the status to the Transfer Order object
to.employee = emp;
to.status = TransferOrderOrderStatus._pendingApproval.ToString();
to.itemList = toil;
// Adding the Transfer order into NetSuite.
WriteResponse res = nss.add(to);
if (res.status.isSuccess)
{
Console.Write("Transfer Order Created");
Console.Read();
}
else
{
Console.Write("Transfer Order Not Created");
Console.Read();
}
}
No comments:
Post a Comment