In NetSuite, I'm trying to set two of my item sublist fields to mandatory on the opportunity record with a user event script. I used the code suggested via SuiteAnswers to do this, but it's not working. When I log the column.isMandatory, it does not return a value.
My code looks like this:
function beforeLoad(scriptContext) {
var rec = scriptContext.newRecord;
var sublistObj = rec.getSublist({
sublistId: 'item'
});
var columnObj = sublistObj.getColumn({
fieldId: 'rate'
});
columnObj.isMandatory = true;
log.debug({
title: 'rate is mandatory',
details: columnObj.isMandatory
});
}