/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define([‘N/ui/message’], function(message) {
function fieldChanged(context) {
var currentRecord = context.currentRecord;
var fieldId = context.fieldId;
if (fieldId === ‘custpage_factor’) {
var stage = currentRecord.getValue(‘custpage_stage’);
if (!stage) {
message.create({
title: “Warning”,
message: “You cannot edit the FACTOR field unless STAGE is set.”,
type: message.Type.WARNING
}).show();
currentRecord.setValue(‘custpage_factor’, ”);
}
}
}
return {
fieldChanged: fieldChanged
};
});