Error – You cannot create an inventory detail for this item. – Creating Item Fulfillment.
I have a requirement to automate the Mark Shipped button displays in the net suite purchase order form.
Mark Shipped button in the creates Item Fulfillment. I have created below code for creating item fulfillment.
iRecord.type = InitializeType.itemFulfillment;
InitializeRef iRef = new InitializeRef();
iRef.typeSpecified = true;
iRef.type = InitializeRefType.salesOrder;
iRef.internalId = soInternalID;
iRecord.reference = iRef;
if (getInitializeResponse.status.isSuccess != true) throw new Exception(getInitializeResponse.status.statusDetail[0].message);
ItemFulfillment iFulfillment = (ItemFulfillment)getInitializeResponse.record;
ItemFulfillmentItemList iFulfillmentItemList = iFulfillment.itemList;
List<ItemFulfillmentItem> iFulfillmentItems = new List<ItemFulfillmentItem>();
////string binNumberInternalId = getBins(iFulfillment.itemList.item[0].item.name);
InventoryAssignment iAssignment = new InventoryAssignment
{ binNumber = new RecordRef { internalId = “3”, type = RecordType.bin, typeSpecified = true },
quantity = 1,
quantitySpecified = true };
List<InventoryAssignment> iAssignmentList = new List<InventoryAssignment>();
iAssignmentList.Add(iAssignment);
iFulfillmentItemList.item[0].inventoryDetail = new InventoryDetail
{ inventoryAssignmentList = new InventoryAssignmentList
{ inventoryAssignment = iAssignmentList.ToArray()
} };
iFulfillmentItemList.item[0].quantity = 1;
ItemFulfillmentItemList iFulfillmentItemNewList = new ItemFulfillmentItemList();
iFulfillmentItemNewList.replaceAll = false;
iFulfillmentItemNewList.item = iFulfillmentItemList.item.ToArray();
ItemFulfillment newItemFulfillment = new ItemFulfillment();
newItemFulfillment.createdFrom = new RecordRef { internalId = soInternalID, type = RecordType.salesOrder, typeSpecified = true };
newItemFulfillment.entity = new RecordRef { internalId = “XXXXXX”, type = RecordType.customer, typeSpecified = true };
newItemFulfillment.shipMethod = new RecordRef { internalId = “XXXXXX”, name = “Standard” };
newItemFulfillment.shippingCost = Convert.ToDouble(“5”);
newItemFulfillment.shipStatus = ItemFulfillmentShipStatus._shipped;
newItemFulfillment.shipStatusSpecified = true;
oCustomFieldRefList = new List<CustomFieldRef>();
StringCustomFieldRef objStringCustomFieldRef = new StringCustomFieldRef();
objStringCustomFieldRef.scriptId = “custbody4”;
objStringCustomFieldRef.value = “eBay US”;
oCustomFieldRefList.Add(objStringCustomFieldRef);
objStringCustomFieldRef = new StringCustomFieldRef();
objStringCustomFieldRef.scriptId = “custbody1”;
objStringCustomFieldRef.value = “22-05005-77941”;
oCustomFieldRefList.Add(objStringCustomFieldRef);
objStringCustomFieldRef = new StringCustomFieldRef();
objStringCustomFieldRef.scriptId = “custbody16”;
objStringCustomFieldRef.value = “192940280928”;
oCustomFieldRefList.Add(objStringCustomFieldRef);
newItemFulfillment.customFieldList = oCustomFieldRefList.ToArray();
newItemFulfillment.itemList = iFulfillmentItemNewList;
ItemFulfillmentPackageList itemPackageList = new ItemFulfillmentPackageList();
ItemFulfillmentPackage[] itemPackages = new ItemFulfillmentPackage[1];
ItemFulfillmentPackage iPackage = new ItemFulfillmentPackage();
iPackage.packageTrackingNumber = “1”;
iPackage.packageWeight = Convert.ToDouble(“0.01”);
iPackage.packageWeightSpecified = true;
itemPackages[0] = iPackage;
itemPackageList.package = itemPackages;
newItemFulfillment.packageList = itemPackageList;
WriteResponse response = Service.add(newItemFulfillment);
if (response.status.isSuccess != true) throw new Exception(response.status.statusDetail[0].message);
When i executing this code i am getting You cannot create an inventory detail for this item. error. when i provide specified BIN NUMBER (for ex. 5117. Here i have provided BIN NUMBER as 3) then i am able to create item fulfillment.
Client is requesting us not to use the BIN NUMBER on creating item fulfillment. Also when i create item fulfillment throw net suite website (not throw code) by clicking the Mark Shipped button in the purchase order form, its not asking us to provide inventory detail and was able to create item fulfillment without providing BIN NUMBER.
Please help me to fix this issue.
Thanks in Advance.