anyone have experience with the non advanced bin m...
# suitescript
i
anyone have experience with the non advanced bin management that requires than bins the assigned on the item record before they can be used on a transaction? I have scripts working in SS1 where I am able to do the bin assignment with no problem, however, working on a Restlet in SS2.1 and getting an error.
Copy code
var itemRec = record.load({
    type: record.Type.INVENTORY_ITEM,
    id: itemid,
    isDynamic: true
});

itemRec.selectNewLine({
    sublistId: 'binnumber'
});
itemRec.setCurrentSublistValue({
    sublistId: 'binnumber',
    fieldId: 'binnumber',
    value: binid
});
itemRec.commitLine({
    sublistId: 'binnumber'
});

itemRec.save();
getting the following error "code": "SSS_INVALID_SUBLIST_OPERATION", "message": "{\"type\":\"error.SuiteScriptError\",\"name\":\"SSS_INVALID_SUBLIST_OPERATION\",\"message\":\"You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.
s
did you try using getCurrentSublistSubrecord? this is some sample code:
Copy code
const inventoryAdjustment = record.create({ type: record.Type.INVENTORY_ADJUSTMENT, isDynamic: true, })
inventoryAdjustment.selectNewLine({ sublistId: 'inventory' });
const binSubrecord = inventoryAdjustment.getCurrentSublistSubrecord({sublistId: 'inventory',fieldId: 'inventorydetail',})
binSubrecord.selectNewLine({ sublistId: 'inventoryassignment' }); 
binSubrecord.setCurrentSublistValue({ sublistId: 'inventoryassignment', fieldId: 'binnumber', value: binnumber });
binSubrecord.setCurrentSublistValue({ sublistId: 'inventoryassignment', fieldId: 'quantity', value: quantity, });
binSubrecord.commitLine({ sublistId: 'inventoryassignment' })
inventoryAdjustment.commitLine({ sublistId: 'inventory' });
inventoryAdjustment.save()
i
i am doing it on the item record not a transaction record, also since not using the advanced bin management, the inventorydetail subrecord does not apply