diff --git a/entity/Salesproject_entity/entityfields/status/onValueChange.js b/entity/Salesproject_entity/entityfields/status/onValueChange.js index 4745b434f63d0151c8c511fdc73e9ac6d9cad1c0..28c14cc18d4f2db77119a72ef8d4023eeca4d851 100644 --- a/entity/Salesproject_entity/entityfields/status/onValueChange.js +++ b/entity/Salesproject_entity/entityfields/status/onValueChange.js @@ -1,7 +1,11 @@ +import("system.neon"); import("Sql_lib"); import("system.vars"); import("system.db"); -vars.set("$context.statusBefore", db.cell(SqlCondition.begin() +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + vars.set("$context.statusBefore", db.cell(SqlCondition.begin() .andPrepareVars("SALESPROJECT.SALESPROJECTID", "$field.SALESPROJECTID") - .buildSql("select STATUS from SALESPROJECT", "1=2"))); \ No newline at end of file + .buildSql("select STATUS from SALESPROJECT", "1=2"))); +}