Saturday, March 30, 2019

Creating an Item Fulfillment via Web Services Using C#

Below is sample code on initializing an Item Fulfillment from a Sales Order. To process this you need a valid Login Session and an existing sales order that is waiting to be fulfilled.
Please note this sample will not work if you have Advanced Inventory Management Enabled.

if (status.isSuccess == true)
// Setting the initialize record type and internal id
InitializeRecord rec = new InitializeRecord();
rec.type = InitializeType.itemFulfillment;
InitializeRef ref1 = new InitializeRef();
ref1.internalId = "4";
ref1.type = InitializeRefType.salesOrder;
ref1.typeSpecified = true;
rec.reference = ref1;

ReadResponse res = new ReadResponse();
//NetSuite Service Object Processing the Initialize Request.
res = nss.initialize(rec);
if (res.status.isSuccess == true)
// Creating the Item Fulfillment record and assigning the location.
ItemFulfillment itemFulf = new ItemFulfillment();
itemFulf = (ItemFulfillment)res.record;

ItemFulfillmentItemList items = (ItemFulfillmentItemList)itemFulf.itemList;
RecordRef loc = new RecordRef();
loc.internalId = "1";
items.item[0].location = loc;

// Adding the Item Fulfillment into Netsuite.
WriteResponse writeResponse = nss.add(itemFulf);

if (writeResponse.status.isSuccess == true)


No comments:

Post a Comment