Disable fields on a record

This sample is a client script that disables fields on a record.

The conversion of this script from SuiteScript 1.0 to SuiteScript 2.1 includes the following:

SuiteScript 1.0 Script

SuiteScript 2.1 Script

                    function pageInit() {
   nlapiDisableField('custrecord_other_fieldA', true);
   nlapiDisableField('custrecord_other_fieldB', true);
} 

                  
                    /**
 * @NApiVersion 2.1
 * @NScriptType ClientScript
 */

define (['N/record'], (record) => {
    function pageInit(context) {
        const myRecord = record.load({
           type: record.Type.TRANSACTION,
           id: 7
        });
        const myRecordFieldA = myRecord.getField({
            fieldId: 'custrecord_other_fieldA'
        });
        const myRecordFieldB = myRecord.getField({
            fieldId: 'custrecord_other_fieldB'
        });
        
        myRecordFieldA.isDisabled = true;
        myRecordFieldB.isDisabled = true;
    }
    
    return {
        pageInit: pageInit
    };
}); 

                  

General Notices