Is it possible to create an Inventory Worksheet us...
# suitescript
t
Is it possible to create an Inventory Worksheet using Suitescript? I am having a hard time creating it because I don’t know what the sublist ID is. The sublist ID is not visible in the XML metadata. I also can’t find inventory worksheets in the records browser. When I try to load the worksheet in my SuiteScript Debugger, I get the ID ‘invt’, but that does not work as it is saying invalid sublist ID
I have also tried Sublist IDs with values such as ‘inventory’, ‘item’, ‘adjustment’, etc. It all gives me this error
Here is my code
Copy code
require(["N/record", "N/format"]);
var record = require("N/record");
var format = require("N/format");
const adjustmentRec = record.create({
    type: 'inventoryworksheet',
    isDynamic: true,
});

adjustmentRec.setValue({
    fieldId: 'account',
    value: 2976,
});

adjustmentRec.setValue({
    fieldId: 'location',
    value: 4,
});

adjustmentRec.setValue({
    fieldId: 'lastinday',
    value: 'T',
});

const formattedDate = format.parse({
    value: "2/13/2025",
    type: format.Type.DATE
});

adjustmentRec.setValue({
    fieldId: 'trandate',
    value: formattedDate,
});

const inventorySublistID = 'invt';

adjustmentRec.selectNewLine({
    sublistId: inventorySublistID
});

adjustmentRec.setCurrentSublistValue({
    sublistId: inventorySublistID,
    fieldId: 'invtid',
    value: '3010'
});

adjustmentRec.setCurrentSublistValue({
    sublistId: inventorySublistID,
    fieldId: 'invtnewqty',
    value: '7000'
});

adjustmentRec.setCurrentSublistValue({
    sublistId: inventorySublistID,
    fieldId: 'invtnewvalue',
    value: '9000'
});

adjustmentRec.commitLine({
    sublistId: inventorySublistID
});

adjustmentRec.save({
    ignoreMandatoryFields: true
});

var x = 0;
n
As far as I am aware, inventoryworksheet is not a Scriptable Record Type. I believe an Inventory Transfer with inventory sublist and/or Inventory Cost Revaluation will do what you are trying to accomplish?
t
Inventory Cost Revaluation does not seem to work for lot numbered inventory items
Thanks for the suggestion anyways. Oh well, too bad Inventory Worksheets are unscriptable