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.
Update: Narrative Insights has been restored and is now available.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
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