How to disable a sublist field in a LIST type sublist in Suitelet

In a LIST type sublist, the field can either be an entry or an inline type field. Using the updateDisplayType function, we cannot set the field as disabled; even if we do, it will display as an inline field.

We can disable this sublist field using jQuery in the client script.

There are two options to set the field as disabled in the client script using jQuery.

In a sublist, the sublist field will have the format ${fieldId}${line number}, with the line number starting from 1.

Option 1:

jQuery('input[id*="' + fieldId + '"]').prop('disabled', true);

Here the field in all the lines will be disabled using the fieldId as a keyword.

Option 2:

let lineCount=recordObj.getLineCount({sublistId: ${sublistId}});
    for(let i=1;i<=lineCount;i++ ){
    jQuery('#' + ${fieldId} + i).attr('disabled', true);
    }

Here we disable each line separately.

Leave a comment

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