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