diff --git a/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml b/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml
index 04d875917753fe320147e9b378b9cfcd42fc74d8..fda245a0ac774d96467b1ffc51330cf34f8eebdd 100644
--- a/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml
+++ b/.liquibase/Data_alias/basic/2019.2/data/init_DocumentTemplateType.xml
@@ -17,7 +17,7 @@
             <column name="CONTAINER" value="DocumentTemplateType"/>
             <column name="SORTING" valueNumeric="1"/>
             <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
+            <column name="ISESSENTIAL" valueNumeric="1"/>
         </insert>
         <insert tableName="AB_KEYWORD_ENTRY">
             <column name="AB_KEYWORD_ENTRYID" value="bb386131-ee36-9771-b458-6751f137a941"/>
@@ -26,7 +26,7 @@
             <column name="CONTAINER" value="DocumentTemplateType"/>
             <column name="SORTING" valueNumeric="2"/>
             <column name="ISACTIVE" valueNumeric="1"/>
-            <column name="ISESSENTIAL" valueNumeric="0"/>
+            <column name="ISESSENTIAL" valueNumeric="1"/>
         </insert>
         <insert tableName="AB_KEYWORD_ENTRY">
             <column name="AB_KEYWORD_ENTRYID" value="bb38aa51-ee36-9771-b458-6751f137a941"/>
diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod
index 4feb132bdf1ebc8490a06a1c524777c1ef6978c0..481e2763153f8c66ebca5795714addac55c58500 100644
--- a/entity/Activity_entity/Activity_entity.aod
+++ b/entity/Activity_entity/Activity_entity.aod
@@ -433,6 +433,13 @@
       <name>DATE_EDIT</name>
       <valueProcess>%aditoprj%/entity/Activity_entity/entityfields/date_edit/valueProcess.js</valueProcess>
     </entityField>
+    <entityActionField>
+      <name>newMail</name>
+      <fieldType>ACTION</fieldType>
+      <title>Mail</title>
+      <onActionProcess>%aditoprj%/entity/Activity_entity/entityfields/newmail/onActionProcess.js</onActionProcess>
+      <iconId>VAADIN:PAPERPLANE_O</iconId>
+    </entityActionField>
   </entityFields>
   <recordContainers>
     <dbRecordContainer>
diff --git a/entity/Activity_entity/entityfields/newmail/onActionProcess.js b/entity/Activity_entity/entityfields/newmail/onActionProcess.js
new file mode 100644
index 0000000000000000000000000000000000000000..d1dda2c1816758ec3d2da559142a9a3f78a52cae
--- /dev/null
+++ b/entity/Activity_entity/entityfields/newmail/onActionProcess.js
@@ -0,0 +1,12 @@
+import("system.logging");
+import("system.db");
+import("system.vars");
+import("system.neon");
+
+var params = {};
+//var doctempIds = db.table("select DOCUMENTTEMPLATEID from DOCUMENTTEMPLATE");
+//logging.log(vars.getString(doctempIds));
+//params["XY_param"] = "Mail";
+
+neon.openContext("DocumentTemplate_context", "DocumentTemplateFilter_view", null, neon.OPERATINGSTATE_VIEW, null);
+
diff --git a/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod b/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod
index 8f3f448246d2b84f1b5e5dec220721c3c667e99d..51c8902f8ed67138ad0b9bd713a8c7f463f3440a 100644
--- a/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod
+++ b/entity/DocumentTemplateLink_entity/DocumentTemplateLink_entity.aod
@@ -59,6 +59,7 @@
       <children>
         <entityParameter>
           <name>DocumentTemplateType_param</name>
+          <title></title>
           <valueProcess>%aditoprj%/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js</valueProcess>
         </entityParameter>
       </children>
@@ -98,15 +99,23 @@
     <dbRecordContainer>
       <name>db</name>
       <alias>Data_alias</alias>
+      <fromClauseProcess>%aditoprj%/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
       <conditionProcess>%aditoprj%/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
       <linkInformation>
         <linkInformation>
-          <name>99ab2840-c45e-4901-8383-91fbb8d82075</name>
+          <name>05d25e85-1cd8-4897-be48-ecf699322b1f</name>
           <tableName>DOCUMENTTEMPLATELINK</tableName>
           <primaryKey>DOCUMENTTEMPLATELINKID</primaryKey>
           <isUIDTable v="true" />
           <readonly v="false" />
         </linkInformation>
+        <linkInformation>
+          <name>34ca9c71-3de5-48ce-ade2-fa203360ebbd</name>
+          <tableName>DOCUMENTTEMPLATE</tableName>
+          <primaryKey>DOCUMENTTEMPLATEID</primaryKey>
+          <isUIDTable v="false" />
+          <readonly v="true" />
+        </linkInformation>
       </linkInformation>
       <recordFieldMappings>
         <dbRecordFieldMapping>
diff --git a/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js b/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..bc450eb560a7a5c7c39bcfb557dd579e30f26eb8 100644
--- a/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
+++ b/entity/DocumentTemplateLink_entity/entityfields/attachments/children/documenttemplatetype_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("KeywordRegistry_basic");
+import("system.result");
+
+result.string($KeywordRegistry.documentTemplateType$attachment());
\ No newline at end of file
diff --git a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js
index e2ebc8de0adefb916e5dd47ec8c36e2d0b7d7842..bab14e8a9c1f3f4f529686b2f55032d0b4bb1e6b 100644
--- a/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js
+++ b/entity/DocumentTemplateLink_entity/entityfields/documenttemplate_id_child/stateProcess.js
@@ -5,9 +5,9 @@ import("system.vars");
 import("system.db");
 
 var parenttype = vars.get("$param.Type_param");
-logging.log(parenttype);
+//logging.log(parenttype);
 
-if(vars.exists(parenttype) && paraenttype != null && parenttype != "MAI"){
-    result.object(neon.COMPONENTSTATE_DISABLED);
-}
-    
\ No newline at end of file
+//if(vars.exists(parenttype) && paraenttype != null && parenttype != "MAI"){
+//    result.object(neon.COMPONENTSTATE_DISABLED);
+//}
+//    
\ No newline at end of file
diff --git a/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js b/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js
index ae6a038872ba9e137fcc10b724488bf2293367fa..71ea6e3b7429b2c32f14f376e501a3dc7ce29180 100644
--- a/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/DocumentTemplateLink_entity/recordcontainers/db/conditionProcess.js
@@ -1,20 +1,8 @@
-import("system.vars");
-import("system.db");
 import("system.result");
+import("system.db");
 import("Sql_lib");
 
 var cond = SqlCondition.begin()
-                       .andPrepareVars("DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT", "$param.DocumentId_param");
-
-//TODO: use a preparedCondition when available #1030812 #1034026
-result.string(db.translateCondition(cond.build("1 = 0")));
+                       .andPrepareVars("DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT", "$param.DocumentId_param")
 
-//if(vars.exists("$param.Type_param") && vars.get("$param.Type_param") != null && vars.get("$param.Type_param") == "ATT"){
-//    
-//    var cond = SqlCondition.begin()
-//                       .andPrepare("DOCUMENTTEMPLATELINK.ATTACHMENT_TYPE", type)
-//                       .andPrepareVars("DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT", docId)
-//                       .build();
-//                       
-//    result.string(db.translateCondition(cond));
-//}
\ No newline at end of file
+result.string(db.translateCondition(cond.build("1=2")));
\ No newline at end of file
diff --git a/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js b/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js
new file mode 100644
index 0000000000000000000000000000000000000000..52d46e62a6de93a2f1853cbc2d94d7f478e583f8
--- /dev/null
+++ b/entity/DocumentTemplateLink_entity/recordcontainers/db/fromClauseProcess.js
@@ -0,0 +1,3 @@
+import("system.result");
+
+result.string("DOCUMENTTEMPLATELINK join DOCUMENTTEMPLATE on DOCUMENTTEMPLATE.DOCUMENTTEMPLATEID = DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT");
\ No newline at end of file
diff --git a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod
index 3fb259e5a8e1df13a81faa8b39ef62c5fdd9cb59..a3509daefc01d27ed4502fe0b6b3df024dbb8611 100644
--- a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod
+++ b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod
@@ -199,6 +199,7 @@
       <name>Links</name>
       <title>Attachment</title>
       <fieldType>DEPENDENCY_OUT</fieldType>
+      <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js</stateProcess>
       <dependency>
         <name>dependency</name>
         <entityName>DocumentTemplateLink_entity</entityName>
diff --git a/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js
new file mode 100644
index 0000000000000000000000000000000000000000..957a413f1d7036e74834b8f00622619178d16b15
--- /dev/null
+++ b/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js
@@ -0,0 +1,9 @@
+import("system.result");
+import("KeywordRegistry_basic");
+import("system.vars");
+import("system.neon");
+
+if(vars.get("$field.TYPE") != $KeywordRegistry.documentTemplateType$mail())
+{
+    result.string(neon.COMPONENTSTATE_INVISIBLE);
+}
\ No newline at end of file
diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js b/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js
index 2478d8b4cf1bc15b794aa2936f2550f2d6d45360..98f1298fa355374b4ce435e8cb69f792a19228e1 100644
--- a/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/DocumentTemplate_entity/recordcontainers/db/conditionProcess.js
@@ -1,22 +1,10 @@
-import("system.logging");
 import("system.result");
 import("system.vars");
 import("system.db");
 import("Sql_lib");
 
-var docTemplateType = vars.get("$param.DocumentTemplateType_param");
-var docTemplateTypeClassification = vars.get("$param.DocumentTemplateTypeClassification_param");
+var cond = SqlCondition.begin()
+                       .andPrepareVars("DOCUMENTTEMPLATE.TYPE", "$param.DocumentTemplateType_param")
+                       .andPrepareVars("DOCUMENTTEMPLATE.CLASSIFICATION", "$param.DocumentTemplateTypeClassification_param");
 
-
-if(docTemplateType != null && docTemplateType != "" && docTemplateTypeClassification != null && docTemplateTypeClassification != "")
-{
-    docTemplateType = docTemplateType.trim();
-    docTemplateTypeClassification = docTemplateTypeClassification.trim();
-    
-    var cond = SqlCondition.begin()
-                           .andPrepare("DOCUMENTTEMPLATE.TYPE", docTemplateType)
-                           .andPrepare("DOCUMENTTEMPLATE.CLASSIFICATION", docTemplateTypeClassification)
-                           .build();
-                           
-    result.string(db.translateStatement(cond));
-}
\ No newline at end of file
+result.string(db.translateStatement(cond.build("1=1")));
\ No newline at end of file
diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js
index c55adc815fa2e46b28af9b47872c29df42390642..82fadaadc5e6ef7900a7da9ec216cb37ea897c3a 100644
--- a/process/KeywordRegistry_basic/process.js
+++ b/process/KeywordRegistry_basic/process.js
@@ -71,4 +71,6 @@ $KeywordRegistry.contactDepartment = function(){return "ContactDepartment";};
 $KeywordRegistry.contactPosition = function(){return "ContactPosition";};
 $KeywordRegistry.contactContactrole = function(){return "ContactContactrole";};
 $KeywordRegistry.documentTemplateType = function(){return "DocumentTemplateType";};
+$KeywordRegistry.documentTemplateType$mail = function(){return "MAI                                 ";};
+$KeywordRegistry.documentTemplateType$attachment = function(){return "ATT                                 ";};
 $KeywordRegistry.documentTemplateTypeCategory = function(){return "DocumentTemplateTypeCategory";};
\ No newline at end of file