Disable a Line Item Field for a specific line

JIRA Task : ECX-43

Disabling some specific field on line can be achieved by using nlapiGetCurrentLineItemValue in SuiteScript 1.0 or the N/currentRecord module in SuiteScript 2.0.

In SuiteScript 1.0

nlapiDisableLineItemField('item', 'amount', true);

In SuiteScript 2.0

 var field = currentRecord.getSublistField({
        sublistId: 'item',
        fieldId: 'description',
        line: #
    });

    if (selectedLine == lineToDisable) {
        field.isDisabled = true;
                    
    } else {
        // allow user to enter value if we are not at that specific line
        field.isDisabled = false;
    }

We need to use the combination of Line Init and Post Sourcing functions with field disabling code in order to avoid that field become editable once a line item is added

Leave a comment

Your email address will not be published. Required fields are marked *