How would you set a default value of a sublist lin...
# suitescript
n
How would you set a default value of a sublist line? I would want Packaged ID of that new line to default to 03
s
Please try the below code snippet by replacing the field Id and the sublist Id function validateLine(scriptContext) { var currentRecord = scriptContext.currentRecord; var currIndex = currentRecord.getCurrentSublistIndex({ sublistId: ‘sublistID’ }); var lineNum = currentRecord.selectLine({ sublistId: 'sublistID', line: currIndex }); currentRecord.setCurrentSublistValue({ sublistId: 'sublistID', fieldId: 'fieldId', value: currIndex + 1, ignoreFieldChange: true }); currentRecord.commitLine({ sublistId: 'sublistID' }); }
This is a client script and will trigger as soon as you click on the line