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> } } } }Problem line is in red.For the purpose of testing, I've resorted to simply writing a constant 17250.00$ as the amount. If the line item already has an amount of 17250, then no problem. If the line item has any other amount, and I try to set it to 17250, I get an Unexpected Error.Help?