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!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Script to count line items on a Purchase order
I am a novice when it comes to writing code. I have a script that I use to (1) count the line item QTY on a purchase order and (2) count the QTY billed on a bill.
The code works fine until I add a "subtotal" line or a "discount" line to the purchase order. Then I receive the following result "NaN"
How do I exclude non-inventory line from the count?
function calculatePOqty (type, name)
{
var c = nlapiGetLineItemCount('item');
var itemCount = 0;
for (var i = 1; i <= c; i++) {
itemCount += parseInt(nlapiGetLineItemValue('item', 'quantity', i), 10);
}
nlapiSetFieldValue('custbody_total_qty', itemCount);
}
function calculateBillqty (type, name)
0