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 Work Order via script
I am trying to change the components on a Work Order via script. When I run the following code through the console, it works as expected:
var workOrder = <em>record</em>.load({ type: <em>record</em>.Type.WORK_ORDER, id: 213, isDynamic: true }); while (workOrder.getLineCount({ sublistId: 'item' }) &gt; 0) { workOrder.removeLine({ sublistId: 'item', line: 0 }); } var allComponents = []; allComponents.<strong>push</strong>({ item: 51, quantity: 800 }); allComponents.<strong>push</strong>({ item: 65, quantity: 200 }); for (var j = 0; j &lt; allComponents.length; j++) { workOrder.selectLine({ sublistId: 'item', line: j }); workOrder.setCurrentSublistValue({ sublistId: 'item', fieldId: 'item', value: allComponents[j].item }); workOrder.setCurrentSublistValue({ sublistId: 'item', fieldId: 'quantity', value: allComponents[j].quantity }); workOrder.commitLine({ sublistId: 'item' }); } workOrder.save(); 0