diff --git a/entity/Pers_entity/entityfields/orgaddress_dfo/children/relid_param/code.js b/entity/Pers_entity/entityfields/orgaddress_dfo/children/relid_param/code.js
new file mode 100644
index 0000000000000000000000000000000000000000..22ba1eb2fb3d6f23e64bb602a05f62bcc94f61be
--- /dev/null
+++ b/entity/Pers_entity/entityfields/orgaddress_dfo/children/relid_param/code.js
@@ -0,0 +1,16 @@
+import("system.result");
+import("system.db");
+import("system.vars");
+import("Sql_lib");
+
+var orgId, orgRelId, sqlHelper;
+ 
+sqlHelper = new LegacySqlUtils();
+orgId = vars.get("$field.ORGID");
+if (orgId){
+    orgRelId = db.cell(["select RELATION.RELATIONID from RELATION where RELATION.PERS_ID is null and RELATION.ORG_ID = ?",
+        [
+            [orgId, sqlHelper.getSingleColumnType("RELATION", "ORG_ID")]
+        ]]);
+    result.string(orgRelId);
+}
\ No newline at end of file