I need a custom field that shows the total amount open on a sales order for reporting purposes; the dollar amount of items on the order that are remaining to be shipped.
I was able to do this as a custom transaction column field, totalling the remaining amount open for each line item using the following formula, however it wouldn't pull into reports --- the field wasn't available:
({quantity}-{quantityfulfilled})*{rate}Perhaps custom transaction column fields can't be pulled into reports? Not sure. So I moved on to something that I figured should work. The thought was to create a custom body field and deploy a client script which would sum the totals of the custom column field from all the line items, and populate the body field with that total. It didn't work either. Netsuite would show an error in the custom body field saying something like "Error field not found".function calculateAmountOpen ( type ) { var lines = nlapiGetLineItemCount( 'item' ); var amountOpen = 0; for ( var i = 1; i < =lines; i++ ) { var custcol_amt_open = nlapiGetLineItemValue( 'item', 'custcol_amt_open', i ); amountOpen = amountOpen + custcol_amt_open; } nlapiSetFieldValue( 'custbody_amount_open', amountOpen ); }So this was our next attempt: simply running the calculation on each individual line item and totaling it all up, then populating the body field. But this didn't work either. No error was displayed, it simply didn't populate the field:function calculateAmountOpen ( type ) { var lines = nlapiGetLineItemCount( 'item' ); var amountOpen = 0; for ( var i = 1; i <= lines; i++ ) { var quantity = parseInt(nlapiGetLineItemValue( 'item', 'quantity', i )); var quantityfulfilled = parseInt(nlapiGetLineItemValue( 'item', 'quantityfulfilled', i )); var rate = parseFloat(nlapiGetLineItemValue( 'item', 'rate', i )); amountOpen += parseFloat((quantity - quantityfulfilled) * rate); } nlapiSetFieldValue( 'custbody_amount_open', amountOpen); }So I am not sure what to do at this point. Has anyone run into anything like this before? Is there a simpler way to accomplish my goal? Is the behavior Netsuite is displaying a bug?Appreciate any help.