Discussions
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)