Israel Gonzalez
09/16/2020, 11:14 PMMike Robbins
09/16/2020, 11:24 PMinventorydetail
subrecord. Load that and you will have access to the tobinnumber
field.Mike Robbins
09/16/2020, 11:24 PMIsrael Gonzalez
09/16/2020, 11:25 PMMike Robbins
09/16/2020, 11:36 PMitembinnumbers
Israel Gonzalez
09/17/2020, 12:59 AMSteve82
09/17/2020, 9:18 AMfunction bulkBinputaway(){
var binParam = nlapiGetContext().getSetting('SCRIPT', 'custscript_scripted_bin_putaway_bin');
var locationParam = nlapiGetContext().getSetting('SCRIPT', 'custscript_scripted_bin_putaway_location');
nlapiLogExecution('debug', 'UPDATE', 'binParam:'+binParam+' locationParam: '+locationParam);
var binPutAway = nlapiCreateRecord('binworksheet',{recordmode:'dynamic',location:locationParam});
var itemsCount = binPutAway.getLineItemCount('item');
for (var i = 1; i <= itemsCount; i++) {
binPutAway.selectLineItem('item',i);
var lineQty = binPutAway.getCurrentLineItemValue('item','quantity');
var lineName = binPutAway.getCurrentLineItemValue('item','displayname');
nlapiLogExecution('debug', 'UPDATE', 'Updated line ' + i + ' ' + lineName + ' Qty: ' + lineQty );
var inventoryDetails = binPutAway.createCurrentLineItemSubrecord('item','inventorydetail');
inventoryDetails.selectNewLineItem('inventoryassignment');
inventoryDetails.setCurrentLineItemValue('inventoryassignment', 'binnumber', binParam );
inventoryDetails.setCurrentLineItemValue('inventoryassignment', 'quantity', lineQty);
inventoryDetails.commitLineItem('inventoryassignment');
inventoryDetails.commit();
binPutAway.commitLineItem('item');
}
var id = nlapiSubmitRecord(binPutAway);
nlapiLogExecution('debug', 'CREATED', 'successfully created binputaway worksheet id: '+id);
}