'How can I disable line item field without disabling entire column using Client Script (SuiteScript 2.0)?

I'm trying to disable sublist field, in order to fillment of another sublist field. However, it seems to me it's not working. I used lineInit(cuz it looks like what i need at the moment).

function lineInit(context) {

        var cr = context.currentRecord;
        var selectedLine = cr.getCurrentSublistIndex({sublistId: "item"});
        var iskontoOran = cr.getCurrentSublistValue({sublistId: "item", fieldId : "custcol_delta_iskonto_oran"});
        if (iskontoOran != "0.00"){
            cr.getCurrentSublistValue({sublistId : "item", fieldId: "custcol_delta_iskonto_tutar", line: 0
            }).isDisabled = true;
        }
        else {
            cr.getCurrentSublistValue({sublistId : "item", fieldId: "custcol_delta_iskonto_tutar", line: 0
            }).isDisabled = false;
        }


Solution 1:[1]

function lineInit(context) {
    var cr = context.currentRecord;
    var iskontoOran = cr.getCurrentSublistValue({sublistId: "item", fieldId : "custcol_delta_iskonto_oran"});
    cr.getSublistField({sublistId : "item", fieldId: "custcol_delta_iskonto_tutar"}).isDisabled = iskontoOran != 0;
}

function fieldChanged(context) {
    var cr = context.currentRecord;
    var sublistName = context.sublistId;
    var sublistFieldName = context.fieldId;
    if (sublistName === 'item' && sublistFieldName === 'custcol_delta_iskonto_oran') {
        var iskontoOran = cr.getCurrentSublistValue({sublistId: "item", fieldId : "custcol_delta_iskonto_oran"});
        cr.getSublistField({sublistId : "item", fieldId: "custcol_delta_iskonto_tutar"}).isDisabled = iskontoOran != 0;
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1