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!
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