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.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
Cannot change line item Amount - unexpected error
I have a Server Side Script, running on before submit on Purchase Orders, that is trying to set the Amount of a line item. However, I get an Unexpected Error whenever I try to change the amount to something other than what it already is.
Here's the code:
function setAllLineItemsPrices() { var record = nlapiGetNewRecord(); var vendor; var item; var qty; var price; if(record.getFieldValue('custbody_refresh_all')=='T') { for(i=1;i&lt;=record.getLineItemCount('item');i++) { vendor = record.getFieldValue('entity'); item = record.getLineItemValue('item','item',i); qty = record.getLineItemValue('item','quantity',i); price = getVolumePrice(vendor,item,qty); //this function fetches a certain unit rate - it works, no problem if(price!=null) { record.setLineItemValue( 'item', 'rate', i, price); <span style="color:'red'">record.setLineItemValue( 'item', 'amount', i, 17250.00);</span> } } } } 0