diff --git a/entity/Organisation_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js b/entity/Organisation_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js
index 04b4079531ba7cc7a965aa5162e950e6213ecfdf..e02b6634f4b41a21ddba3d197f3429978f4fb0c9 100644
--- a/entity/Organisation_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js
+++ b/entity/Organisation_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js
@@ -1,7 +1,21 @@
+import("Entity_lib");
 import("system.logging");
 import("system.vars");
 import("system.result");
 
+//references needed for auto refresh:
+"$field.Addresses.insertedRows";
+"$field.Addresses.changedRows";
+"$field.Addresses.deletedRows";
+
 var country = vars.get("$field.STANDARD_COUNTRY");
 if (country)
-    result.string(country);
\ No newline at end of file
+{
+    result.string(country);
+}
+else 
+{
+    var addressRows = EntityConsumerRowsHelper.getCurrentConsumerRows("Addresses", ["COUNTRY"]);
+    if(addressRows.length > 0)
+        result.string(addressRows[0]["COUNTRY"]);
+}
diff --git a/entity/Person_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js b/entity/Person_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js
index 04b4079531ba7cc7a965aa5162e950e6213ecfdf..48e3079503511a492aae0634eeb6853d9f198fe3 100644
--- a/entity/Person_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js
+++ b/entity/Person_entity/entityfields/communications/children/contactsmaincountry_param/valueProcess.js
@@ -1,7 +1,36 @@
+import("Sql_lib");
+import("Entity_lib");
 import("system.logging");
 import("system.vars");
 import("system.result");
 
+//references needed for auto refresh:
+"$field.PersAddresses.insertedRows";
+"$field.PersAddresses.changedRows";
+"$field.PersAddresses.deletedRows";
+
+var res = "";
 var country = vars.get("$field.STANDARD_COUNTRY");
-if (country)
-    result.string(country);
\ No newline at end of file
+var orgAddressId = newSelect("CONTACT.ADDRESS_ID").from("CONTACT")
+                                                    .where("CONTACT.ORGANISATION_ID", vars.get("$field.ORGANISATION_ID"))
+                                                    .and("CONTACT.PERSON_ID is null")
+                                                    .cell();
+                                                                    
+var standardCountryOrg = newSelect("ADDRESS.COUNTRY").from("ADDRESS")
+                                                             .where("ADDRESS.ADDRESSID", orgAddressId).cell();
+
+if(country)
+{
+    res = country;
+}
+else if(standardCountryOrg)
+{
+    res = standardCountryOrg;
+}
+else
+{
+    var addressPersonRows = EntityConsumerRowsHelper.getCurrentConsumerRows("PersAddresses", ["COUNTRY"]);
+    if(addressPersonRows.length > 0)
+        res = addressPersonRows[0]["COUNTRY"];
+}
+result.string(res);
\ No newline at end of file