I am hoping someone can help. We are re-writing our offline Point of sale system to work with NetSuite in place of our current ERP system. We think we have it almost completed and have been downloading invoices into NetSuite. We feel we have worked out all the bugs except for one. We can’t seem to figure out how to select a bin through inventory detail on the invoice. We can do it on inventory adjustments and credit memo’s but the code won’t work on invoices. Any insight would be a huge help to us.
// Create invoice
var record = nlapiCreateRecord('invoice');
// Set invoice fields here...
// Create a line
record.selectNewLineItem('item');
//Set line fields here...
// Create Inventory Detail Subrecord
var invDetail = record.createCurrentLineItemSubrecord( 'item',
'inventorydetail');
// Sublist of Inventory Detail Subrecord
invDetail.selectNewLineItem('inventoryassignment');
// Here is where I am setting the qty - invQty is confirmed to = X
invDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', invQty);
invDetail.setCurrentLineItemValue('inventoryassignment', 'binnumber', binID);
// Submit the values set in Sublist of the Subrecord
invDetail.commitLineItem('inventoryassignment');
invDetail.commit(); // submit Subrecord
// Commit the line
record.commitLineItem('item');
This is the error message we are getting.
The total inventory detail quantity must be 6.
We have also tried this and received the error below.
var invDetail =record.createCurrentLineItemSubrecord('inventory',
'inventorydetail'); // Inventory Detail Subrecord
// Sublist of Inventory Detail Subrecord
invDetail.selectNewLineItem('inventorydetail');
// Internal ID of the bin you want to set to "From Bins".
invDetail.setCurrentLineItemText('inventoryassignment', 'binnumber', binID);
// Value of Quantity you want set. Must be equal with the
// quantity set on the line item.
invDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', invQty);
// Submit the values set in Sublist of the Subrecord
invDetail.commitLineItem('inventoryassignment');
invDetail.commit(); // submit Subrecord
When we run it it gives the error:
You must enter at least one line item for this transaction.