diff --git a/entity/Product_entity/entityfields/relation_id/linkedContextProcess.js b/entity/Product_entity/entityfields/relation_id/linkedContextProcess.js index d94556cde2fcc04bf1405ee0446a14cdc3550cf2..48528c5c24f559c391ad1f050e610943145da865 100644 --- a/entity/Product_entity/entityfields/relation_id/linkedContextProcess.js +++ b/entity/Product_entity/entityfields/relation_id/linkedContextProcess.js @@ -2,4 +2,5 @@ import("system.vars"); import("system.result"); import("Relation_lib"); -result.string("Org_context"); \ No newline at end of file +if(vars.get("$field.RELATION_ID")) + result.string("Org_context"); \ No newline at end of file diff --git a/entity/Task_entity/onValidation.js b/entity/Task_entity/onValidation.js index adec45e2126cefedb731170f258d89d77162deb9..9d163bb6d1dd266ac8be3fa38724bf65c8a58199 100644 --- a/entity/Task_entity/onValidation.js +++ b/entity/Task_entity/onValidation.js @@ -4,13 +4,12 @@ import("system.text"); import("system.neon"); import("Sql_lib"); -//TODO: crashes server -//if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) -//{ -// var maskingHelper = new SqlMaskingUtils(); -// var newCodeNumber = db.cell("select " + maskingHelper.max("TASK.CODE") + " from TASK"); -// newCodeNumber = Number(newCodeNumber);//if no number exists till no, start value will be 1 (due to: ++0) -// if (isNaN(newCodeNumber)) -// throw new TypeError();//TODO:add Message -// neon.setFieldValue("$field.CODE", text.formatLong(++newCodeNumber, "0000000")); -//} \ No newline at end of file +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var maskingHelper = new SqlMaskingUtils(); + var newCodeNumber = db.cell("select " + maskingHelper.max("TASK.CODE") + " from TASK"); + newCodeNumber = Number(newCodeNumber);//if no number exists till no, start value will be 1 (due to: ++0) + if (isNaN(newCodeNumber)) + throw new TypeError();//TODO:add Message + neon.setFieldValue("$field.CODE", ++newCodeNumber); +} \ No newline at end of file