User wants to validate the mode in which the record is being accessed (create, copy, or edit) in the saveRecord function of a SuiteScript (SS) 2.0 Client Script.
define([], function(){
var currentMode; // declare a global variable
function pageInit(scriptContext) {
currentMode= scriptContext.mode;
}
function saveRecord(scriptContext) {
if(currentMode!= 'edit'){
}
}
return {
pageInit: pageInit,
saveRecord : saveRecord
};
});