Hi Gurus
I am getting the below error when trying to create a bin transfer via SuiteScript. The funny thing is that both fields from bin (binNumber) and to bin (toBinNumber) are differents. On my code below you will notice that the from bin id is 45 and the to bin id is 49
Just so you know, I made sure I am using the correct field names and values . I followed this tutorial https://suiteanswers.custhelp.com/app/answers/detail/a_id/39319 but I keep getting the below error:
{"type":"error.SuiteScriptError","name":"USER_ERROR","message":"The from and to bins must be different.","id":"","stack":["Error\n at RecordInvoker.commitLine (suitescript/resources/javascript/record/serverRecordService.js:278:5)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.afterSubmit (/SuiteScripts/TEST_us_employee.js:162:19)"],"cause":{"type":"internal error","code":"USER_ERROR","details":"The from and to bins must be different.","userEvent":null,"stackTrace":["Error\n at RecordInvoker.commitLine (suitescript/resources/javascript/record/serverRecordService.js:278:5)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.afterSubmit (/SuiteScripts/TEST_us_employee.js:162:19)"],"notifyOff":false},"notifyOff":false,"userFacing":true}
here is my code:
var obj = record.create({
type: record.Type.BIN_TRANSFER,
isDynamic: true
});
obj.setValue({fieldId: 'location', value: 13}); // --> Internal ID of the location you want to set
obj.setValue({fieldId: 'memo', value: 'Advanced Bin'});// 'Advanced Bin' --> Text (Optional)
obj.selectNewLine({sublistId: 'inventory'});// --> Sublist
obj.setCurrentSublistValue({sublistId: 'inventory', fieldId: 'item', value: 1129}); // --> internal ID of the item you want to set
obj.setCurrentSublistValue({sublistId: 'inventory', fieldId: 'quantity', value: 110});// --> Value of Quantity you want to set (integer)
var x = obj.getCurrentSublistSubrecord({sublistId: 'inventory', fieldId: 'inventorydetail'});// --> Subrecord
x.selectNewLine({sublistId: 'inventoryassignment'});// --> Sublist of Subrecord
x.setCurrentSublistValue({sublistId: 'inventoryassignment', fieldId: 'binNumber', value: 45});// --> internal ID of the bin you want to set to "From Bins"
x.setCurrentSublistValue({sublistId: 'inventoryassignment', fieldId: 'toBinNumber', value: 49});// --> internal ID of the bin you want to set to "To Bins"
x.setCurrentSublistValue({sublistId: 'inventoryassignment', fieldId: 'quantity', value: 110}); // --> Value of Quantity you want set
// NOTE: Make sure the quantity in var x and var obj is the same
x.commitLine({sublistId: 'inventoryassignment'}); // submit the values set in Sublist of the Subrecord
x.save(); // submit Subrecord
obj.commitLine({sublistId: 'inventory'});//submit values set in Sublist
var recID = obj.save();// submit Created Record for Bin Transfer
Any help will really appreciated!!.
Thanks a lot!