'Is there a way to disable a sublist field while choosing dropdown value from the same sublist. SuiteScript 2.0 getSublistField method not working

I am required to disable one of the filed from a list dynamically while choosing the option from dropdown. Example i have main category value as accomodation and a field in the same line as number of days stay. the stay field is diabled while creating itself. i want to enable this line item field only when accomodation is choosed in the dropdown menu.

I have tried using getSublistFiled to get the stay field refernce but it is showing an error and also isDisabled.

  var fld1 = currentRecord.getSublistField({
                    sublistId: 'recmachcustrecord_expse_clm_itm_parent',
                    fieldId: 'custrecord_expse_clm_itm_sub_catgry',
                    line: currentLine
                });
                fld1.isDisabled = true;

Thanks in advance for the help!



Solution 1:[1]

You are using currentRecord.getCurrentSublistValue. You should use currentRecord.getSublistField.

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 Victor Chern