Any idea why I get "You cannot create an inventor...
# suitescript
d
Any idea why I get "You cannot create an inventory detail for this item" error when trying to create Inventory Transfer record via script, the Item is serial item and I can configure inventory detail for this item in the UI
m
Could you post a snippet of the code? Are there other non-serial/lot/bin items within the transfer also? Last time I saw that I had a mix of serial and non-serial and had inadvertently tried to do an inventory detail on a non-serial item along with the serial item.
d
Copy code
rec.selectNewLine('inventory');
                    rec.setCurrentSublistValue('inventory', 'item', obj.itemId);
                    rec.setCurrentSublistValue('inventory', 'adjustqtyby', obj.selectedQty);

                    let invDet = rec.getCurrentSublistSubrecord('inventory', 'inventorydetail');
                    invDet.selectNewLine('inventoryassignment');
                    invDet.setCurrentSublistValue('inventoryassignment', 'issueinventorynumber', obj.lotId);
                    if (obj.selectedBin) {
                        invDet.setCurrentSublistValue('inventoryassignment', 'tobinnumber', obj.selectedBin.value);
                    }
                    invDet.setCurrentSublistValue('inventoryassignment', 'quantity', obj.selectedQty);
                    invDet.commitLine('inventoryassignment');
                    rec.commitLine('inventory');
                

                let invTranId = rec.save();

There is no loop or something, just record with one line I create
m
@David Na Two thoughts here. • Is there a value in obj.selectedBin, is the selected bin available at the location the item is trying to transfer to? • If there is no value in obj.selectedBin, a bin may be required?
d
Ye, the problem was with the locaiton. thanks!