Reputation: 1
I am required to write some code that disables a transaction column e.g. 'quantity' on a sublist e.g. 'item' on say a purchase order.
I seem to have reached a block as my code is not working.
See my code below:
/**
* @NApiVersion 2.0
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(['N/record'],
/**
* @param {record} record
*/
function(record) {
function sublistChanged(scriptContext) {
var currentForm = scriptContext.currentRecord;
var getSublist = currentForm.getSublist({
sublistId: 'item'
fieldId: 'quantity'
});
getSublist.isDisabled = true;
}
return {
sublistChanged: sublistChanged,
};
});
Upvotes: 0
Views: 2856
Reputation: 8847
You do not use the isDisabled
property to change field display. The proper way to modify field display types in NetSuite is to retrieve a reference to the Field
object, then call its updateDisplayType()
method. See the Help page titled Field.updateDisplayType(options)
for details on this method.
To retrieve a reference to a sublist column, you:
Sublist
from the Form
or Record
Field
from the Sublist
updateDisplayType()
on the Field
Will end up looking something like:
var sublist = context.newRecord.getSublist(...);
var column = sublist.getField(...);
column.updateDisplayType(...);
Upvotes: 1