From e230c028713fe759e7c5852a163eb77808de2dae Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Mon, 25 Mar 2019 17:28:51 +0100
Subject: [PATCH] contact_entity: added workaround for lookup-onvalidation

---
 .../entityfields/organisation_id/onValidation.js            | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/entity/Contact_entity/entityfields/organisation_id/onValidation.js b/entity/Contact_entity/entityfields/organisation_id/onValidation.js
index 7af59e488e9..dc76ba738bc 100644
--- a/entity/Contact_entity/entityfields/organisation_id/onValidation.js
+++ b/entity/Contact_entity/entityfields/organisation_id/onValidation.js
@@ -8,6 +8,12 @@ import("Sql_lib");
 var personId = vars.get("$field.PERSON_ID");
 var organisationId = ProcessHandlingUtils.getOnValidationValue("$field.ORGANISATION_ID");
 
+//workaround for organisationId: $local.value will return the name of the organisation which is not what we want
+//but the field already contains the changed value; so let's load the field instead of the $local.value-variable
+//this is a bug within the ADITO-kernel
+//TODO: change the workaround behaviour when $local.value is retrieved correct
+organisationId = vars.get("$field.ORGANISATION_ID")
+
 if (personId && organisationId)
 {    
     var alreadyExistantContactId = db.cell(SqlCondition.begin()
-- 
GitLab