I'm trying to get the serial numbers from a Fulfillment record in a Netsuite account that is using Advanced Inventory (unlike the Netsuite regular inventory system, Advanced Inventory stores the serial number in a subrecord to the transaction record). I've tried using the example that Netsuite provides and I get a NULL response. I've tried accessing an existing Saved Search and I get the wrong fields (the Saved Search works fine from the UI). Does anyone know what the trick is? Here's the code example that Netsuite provides -
var ffill=nlapiLoadRecord('itemfulfillment', 5892, {recordmode: 'dynamic'});
ffill.selectLineItem('item', 1);
var invDetailSubrecord = ffill.viewCurrentLineItemSubrecord('item', 'inventorydetail');
invDetailSubrecord.selectLineItem('inventoryassignment', 1);
nlapiLogExecution('DEBUG', 'inventory number: ' + invDetailSubrecord.getCurrentLineItemValue('inventoryassignment', 'receiptinventorynumber'));
With the above code I get NULL from the Debug statement - "Debug Serial Mgr - Create inventory number = null"
And here is the code using an existing Saved Search -
var results = nlapiSearchRecord('itemfulfillment', 620, null, null);
var result = results[0];
var columns = result.getAllColumns();
var columnlen = columns.length;
for (ci = 0; ci < columnLen; ci++)
{
var column = columns[ci];
var label = column.getLabel();
var value = result.getValue(column);
nlapiLogExecution('DEBUG','Serial Mgr', 'Columns ' + label + " " + value);
With this code I get 3 columns from the search but the wrong fields (Itemship and 553 are not correct) - "Debug Serial Mgr Columns null 10/16/2013" "Debug Serial Mgr Columns null ItemShip" "Debug Serial Mgr Columns null 553"