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!
How to Count Billed Lines in the Purchase Order Record via SuiteScript?
I am working through a Suitescript with a Purchase Order where some line items are billed and some are not - I need to get a count of the lines that are billed. Here is the code I am using but I continue to get j=0 - what am i doing wrong?
var purchaseOrder = record.load({
type: record.Type.PURCHASE_ORDER,
id: poID
});
var j = 0;
for (var i = 0; i < totallinecount; i++) {
var billed = purchaseOrder.getSublistValue({
sublistId: 'item',
fieldId: 'quantitybilled',
line: i
});
log.debug('#', billed);
if (billed != '' && billed != null) {j += billed}
}
log.debug('j',j)
Tagged:
0