I am trying to disable the amount field on a subli...
# suitescript
m
I am trying to disable the amount field on a sublist, why is this not working?
Copy code
if (fieldName == "amount") {
                        var amountField = currentForm.getCurrentSublistValue({
                            sublistId: 'item',
                            fieldId: 'amount'
                        });
                        amountField.isDisabled = true;
                    }
b
the problem probably lies in that you appear to be writing a client script, but you appear to be trying to manipulate a form, which is only available in user event scripts and suitelets
if you are using a client script, you only have access to a currentRecord, so you can only get to the field
Copy code
scriptContext.currentRecord.getSublistField({
    sublistId: 'item',
    fieldId: 'amount',
    line: 0
}.isDisabled = true
though im not sure if NetSuite will respect that choice. NetSuite uses that field for calculations