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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Updating a location on a cashsale with assembly items
I have a need to update the location of a cash sale, but I'm running into issues. The line items for the cash sale are assembly items, and therefore have their own locations. When I try updating just the cash sale body location, I get an error telling me I need to update the inventorydetail for item 1.
Here is the current script with the attempt to update the inventory detail. This just throws UNEXPECTED_ERROR. Any insight would be greatly appreciated.
record = nlapiLoadRecord("cashsale", id); if (!record) { throw new Error('An Record with this ID does not exists'); } record.setFieldValue("location", 24); var totalLine = record.getLineItemCount("item"); for (var index = 1; index <= totalLine; index++) { record.selectLineItem("item", index); var subrecord= record.editCurrentLineItemSubrecord("item", "inventorydetail"); if (subrecord){ subrecord.setFieldValue("location",24); subrecord.commit(); } record.commitLineItem("item"); } var returnValue = nlapiSubmitRecord(record); 0