I have the following items and bins:
Item Name: 1335 (Internal ID: 137)
Bin 1: 207023 (Internal ID: 4003)
Bin 2: 207101 (Internal ID: 4017)
When I try to script a transfer from Bin 1 to Bin 2 using the bin's name, I get the following error:
INVALID_KEY_OR_REF: Invalid binnumber reference key 207023
I get the same error when using the Bin's ID
INVALID_KEY_OR_REF: Invalid binnumber reference key 4003
I get the same error when using setCurrentLineItemText instead of setCurrentLineItemValue.
I get the same error regardless of which bin I use for either the frombin or the tobin.
I get the same error regardless of whether my variables are numbers or strings.
Can someone explain to me why this is and how I can fix it?
Consider this excerpt from my code:
var itemID = request.getParameter("itemid").toFloat(), fromBinID = request.getParameter("frombin").toFloat(), toBinID = request.getParameter("tobin").toFloat(), qty = request.getParameter("qty").toFloat(); var binTransfer = nlapiCreateRecord('bintransfer'); binTransfer.setFieldValue('location', "1" ); binTransfer.selectNewLineItem('inventory'); binTransfer.setCurrentLineItemValue('inventory', 'item', itemID ); binTransfer.setCurrentLineItemValue('inventory', 'quantity', qty ); var invDetail = binTransfer.createCurrentLineItemSubrecord('inventory', 'inventorydetail'); invDetail.selectNewLineItem('inventoryassignment'); invDetail.setCurrentLineItemValue('inventoryassignment', 'binnumber', fromBinID ); invDetail.setCurrentLineItemValue('inventoryassignment', 'tobinnumber', toBinID ); invDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', qty); invDetail.commitLineItem('inventoryassignment'); invDetail.commit(); binTransfer.commitLineItem('inventory'); var transferid = nlapiSubmitRecord( binTransfer ); Additional Note: the toFloat() function above is a custom one that returns a number when given a string. I am certain that it is working correctly.