Wednesday, January 30, 2019

Create Bin Transfer record via SuiteScript

This article includes a sample script for creating Bin Transfers via SuiteScript. Code: (Suitelet)

function createBinTransfer(request, response)
{
 var rec = nlapiCreateRecord('bintransfer');
 
 rec.setFieldValue('location', 3); // US
 rec.setFieldValue('memo', 'test');
 
 // add the items to be transferred between bins
 rec.selectNewLineItem('inventory');
 rec.setCurrentLineItemValue('inventory', 'item', 40); // item
 rec.setCurrentLineItemValue('inventory', 'quantity', 5); // qty
 rec.setCurrentLineItemValue('inventory', 'frombins', 'US_BinA'); // from bins
 rec.setCurrentLineItemValue('inventory', 'tobins', 'US_BinB'); // to bins
 rec.commitLineItem('inventory');
 
 recId = nlapiSubmitRecord(rec);

 response.write(recId);
}

No comments:

Post a Comment