I'm trying to use the nlapiGetLineItemCount('purchaseorder');
command to get the number of lines of a Purchase Order. But it just return '-1' .
Is there something wrong with my code?
Thank you!
EDIT: I've also tried nlapiGetLineItemCount('item');
and it's have the same behavior if there is something inexistent. Like this: nlapiGetLineItemCount('trying_lines');
If you tried in browser console you should be in "Edit Mode" (hit the record edit button or add &e=T to record url).
nlapiGetLineItemCount('item');
ClientScript 2.0
require(['N/currentRecord'], function (currentRecord) {
console.log('getLineCount', currentRecord.get().getLineCount({sublistId: 'item'})
});
UserEvent 2.0 (in before load function)
function beforeLoad(context){
log.debug('getLineCount', context.newRecord.getLineCount({sublistId: 'item'}))
}