NetSuite newbie here.
I have a SuiteScript that loads the results of a sales order query and then creates a work order for each of those results.
Is it possible to also create sublist items in the same stroke or will I have to load each new workorder and then create it that way? If so, any code samples for that? My little script is below.
I have attempted things with insertLineItem
and nlapiSelectNewLineItem
but no luck so far.
Thanks!
function example1() {
var arrSearchResults = nlapiSearchRecord(null, 'searchID', null,
null);
for ( var i in arrSearchResults) {
var searchResult = arrSearchResults[i];
// create work order records
var recWorkOrder = nlapiCreateRecord('workorder');
recWorkOrder.setFieldValue('quantity', '8');
recWorkOrder.setFieldValue('assemblyitem', itemInternalId);
// recWorkOrder.setFieldValue('options', internalId);
nlapiSubmitRecord(recWorkOrder);
//Create sublist items here?
}
var kilroy = 'was here';
}