Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Please note that on Saturday, April 18, 2026, at 8:00 PM Pacific Time, our Case Management System will undergo a scheduled maintenance for approximately 15 minutes. During this time, case creation via SuiteAnswers will be unavailable and inbound calls will be routed to Customer Service.
Creating Inventory Adjustments: Add a line item
I am doing some exploratory work on whether or not we can automate some inventory transfers for a demo program that we have. I am trying to create an Inventory Adjustment record that subtracts inventory from one warehouse and adds it to another. Everything seems to work just fine in how the nlobjRecord is manipulated, but when I submit it I keep getting the following error:
UNEXPECTED_ERROR: You must enter at least one line item for this transaction.
The code that generates this error follows:
function testAdjCreate() { try { var existing = nlapiLoadRecord("inventoryadjustment", "67071"); var xfer = nlapiCreateRecord("inventoryadjustment"); xfer.setFieldValue("account", "305"); xfer.setFieldValue("adjlocation", "4"); xfer.setFieldValue("haslines", "T"); xfer.setLineItemValue("inventory", "item", 1, 768); xfer.setLineItemValue("inventory", "location", 1, 5); xfer.setLineItemValue("inventory", "adjustqtyby", 1, 5); xfer.setLineItemValue("inventory", "item", 2, 768); xfer.setLineItemValue("inventory", "location", 2, 4); xfer.setLineItemValue("inventory", "adjustqtyby", 2, -5); var count = xfer.getLineItemCount("inventory"); var id = nlapiSubmitRecord(xfer, true); } catch (err) { alert (err.getCode() + ":n" + err.getDetails()); } } 0