Hi, Netsuite Guru,
I have client script that accept request send from Netsuite payment form button (custermized), it trigger function below so that the request get processed. I use currentRecord.getLineCount() and currentReord.getSublistValue() to get line item information. It works fine. However, there are more lines under this sublist so the sublist is the root of more lines. How can depp into sublist of sublist lines to get data? Using Netsuite field explorer, I can tell, if not manually get into sub lines from Netsuite Payment page, the sublist line under sublist will not show up. Now, in the clientscript, how can I get data sublist of sublist line from the currenrRecord module?
Thanks in advance.
/**
*@NApiVersion 2.x
*@NScriptType ClientScript
*/
define(["N/currentRecord"], function (currentRecord)
{ function uploadPaymentData() {
var currRec = currentRecord.get();
var id = currRec.id;
var type = currRec.type;
var entity = currRec.getValue('entity');
var paymentDate = currRec.getValue('trandate');
var size = currRec.getLineCount({ sublistId: 'apply'});
var lids = getLineIds(size, currRec);
// ... code doing more
});
}
function getLineIds(size, obj)
{
var lineIds = '';
if (size > 0) {
for (var i = 0; i < size; i++) {
if (i > 0) {
lineIds = lineIds + ',' + obj.getSublistValue ({
sublistId : 'apply',
fieldId : 'internalid',
line : i
})
} else {
lineIds = obj.getSublistValue({
sublistId : 'apply',
fieldId : 'internalid',
line : i
})
}
}
return lineIds;
}
}
return {
pageInit: pageInit,
uploadPaymentData: uploadPaymentData
};
});