Rob
01/22/2025, 11:03 PMCeligo AI
01/22/2025, 11:03 PMAI generated answer (using internal Slack threads):To disable a field on field change in NetSuite, you can use the
updateDisplayType
method in a User Event script or Client script. Here's how you can do it:
In a User Event script, you can use the beforeLoad
trigger and the context.form
object to find a field by its id and then set fieldObject.disabled=true
. Here's a sample code:
javascript
const button = context.form.getButton({id: buttonId});
if (!button) {
return;
}
button.isDisabled = true;
In a Client script, you can use the fieldChanged
function to disable a field when another field is changed. Here's a sample code:
javascript
function fieldChanged(context) {
var currentRecordObj = currentRecord.get();
var sublistId = context.sublistId;
var fieldId = context.fieldId;
if (sublistId === 'item') {
var item = currentRecordObj.getCurrentSublistValue({
sublistId: 'item',
fieldId: fieldId
});
if (item) {
currentRecordObj.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'rate',
line: lineNumber,
value:'',
ignoreFieldChange: true
}).isDisabled=true;
} else {
currentRecordObj.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'rate',
line:lineNumber,
value:'',
ignoreFieldChange: true
}).isDisabled=true;
}
}
}
Please note that the isDisabled
property is not available for the getCurrentSublistValue
and setCurrentSublistValue
methods. You should use the updateDisplayType
method to disable a field.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
01/22/2025, 11:03 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826064408
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820235789
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813091218
Celigo AI
01/22/2025, 11:03 PM