Pre 2009.2, transferring inventory quantity from one location to another via SuiteScript can only be done through inventoryadjustment. First you have to add quantity to destination location.
xfer.setLineItemValue("inventory", "item", 1, ITEM_ID);
xfer.setLineItemValue("inventory", "location", 1, LOC_DESTINATION);
xfer.setLineItemValue("inventory", "adjustqtyby", 1, "5");
xfer.setLineItemValue("inventory", "location", 1, LOC_DESTINATION);
xfer.setLineItemValue("inventory", "adjustqtyby", 1, "5");
Then you have to deduct the quantity from the origin location
xfer.setLineItemValue("inventory", "item", 2, ITEM_ID);
xfer.setLineItemValue("inventory", "location", 2, LOC_ORIGIN);
xfer.setLineItemValue("inventory", "adjustqtyby", 2, "-5");
xfer.setLineItemValue("inventory", "location", 2, LOC_ORIGIN);
xfer.setLineItemValue("inventory", "adjustqtyby", 2, "-5");
Putting it all together, the code will roughly look like this:
Continue reading ‘SuiteScript: Inventory Transfer via Code’