I have the internal ID of an item which I would li...
# suitescript
m
I have the internal ID of an item which I would like to set when a new Sales Order (to be created) opens. I am getting an unexpected error with this code:
Copy code
currentRecord.selectLine({
            sublistId: "item",
            line: 0
        });
        currentRecord.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'item',
            value: item
        });
        currentRecord.commitLine({
            sublistId: 'item'
        });

        //var recordId = currentRecord.save();
        alert("Line Committed");
What might be the issue here?
w
This is a clientscript, correct?
Have you tried currentRecord.selectNewLine()? Are you sure you can commit the line? There could be other required values, but then you should get an error message about it.
m
Client script, correct. Commit line should just add the line, that's all? I will try selectNewLine()
selectNewLine() works. I've hardcoded the item id but when I retrieve this value from url query I get the item as a string. Figured value: parseInt(item) or value: Number(item) would work but it didn't. Any ideas?