Trying to get count of specific line items in Purchase Order
Answered
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)
Best answer
Are you missing a quotation mark in the first section of your if statement?



