Can anyone help explain why Im getting this error:...
# suitescript
c
Can anyone help explain why Im getting this error: TypeError: Cannot call method "getField" of null. This is the line of code where im trying to disable the class field in the sublist of a sales order: scriptContext.form.getSublist('item').getField('class').updateDisplayType({displayType:'disabled'});
e
pretty sure it requires you to pass
id
for each of those methods… try
form.getSublist({id: 'item'}).getField({id: 'class'}).updateDisplayType({displayType: 'disabled'});
i also don’t really like chaining these types of methods in NetSuite… if someone hides the field or sublist and it isn’t there… your script will throw an error, just as it did which can be ugly. You may want to add some checks for that.