From 114c2eaaff9d9139174c9ecb2369a94e405477f8 Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Wed, 27 Mar 2019 13:20:47 +0100
Subject: [PATCH] "new Contact"-action: autoset private-dummy-organisation

---
 entity/Contact_entity/Contact_entity.aod              |  1 +
 .../entityfields/organisation_id/valueProcess.js      | 11 +++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 entity/Contact_entity/entityfields/organisation_id/valueProcess.js

diff --git a/entity/Contact_entity/Contact_entity.aod b/entity/Contact_entity/Contact_entity.aod
index 2cffc73dc9..2525ff9c3b 100644
--- a/entity/Contact_entity/Contact_entity.aod
+++ b/entity/Contact_entity/Contact_entity.aod
@@ -18,6 +18,7 @@
       <title>Organisation</title>
       <consumer>Organisations</consumer>
       <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/valueProcess.js</valueProcess>
       <displayValueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js</displayValueProcess>
       <onValidation>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/onValidation.js</onValidation>
       <onValueChange>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/onValueChange.js</onValueChange>
diff --git a/entity/Contact_entity/entityfields/organisation_id/valueProcess.js b/entity/Contact_entity/entityfields/organisation_id/valueProcess.js
new file mode 100644
index 0000000000..b25ed87f45
--- /dev/null
+++ b/entity/Contact_entity/entityfields/organisation_id/valueProcess.js
@@ -0,0 +1,11 @@
+import("system.result");
+import("system.vars");
+import("system.neon");
+
+if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value"))
+{
+    if(!vars.get("$field.ORGANISATION_ID"))
+    { 
+        result.string("0");
+    }
+}
\ No newline at end of file
-- 
GitLab