diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod
index 76a4c4cdb8f82ae577c0bce945d3914c644f1427..8a985edb72bae272bec080a875477ba4926e44fb 100644
--- a/entity/CampaignStep_entity/CampaignStep_entity.aod
+++ b/entity/CampaignStep_entity/CampaignStep_entity.aod
@@ -1,485 +1,486 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11">
-  <name>CampaignStep_entity</name>
-  <majorModelMode>DISTRIBUTED</majorModelMode>
-  <icon>NEON:GROUP_APPOINTMENT</icon>
-  <title>Campaign Step</title>
-  <siblings>
-    <element>CampaignPlanning_entity</element>
-    <element>Campaign_entity</element>
-  </siblings>
-  <contentTitleProcess>%aditoprj%/entity/CampaignStep_entity/contentTitleProcess.js</contentTitleProcess>
-  <onValidation>%aditoprj%/entity/CampaignStep_entity/onValidation.js</onValidation>
-  <imageProcess>%aditoprj%/entity/CampaignStep_entity/imageProcess.js</imageProcess>
-  <titlePlural>Steps</titlePlural>
-  <recordContainer>db</recordContainer>
-  <entityFields>
-    <entityProvider>
-      <name>#PROVIDER</name>
-      <dependencies>
-        <entityDependency>
-          <name>13f82959-7e04-449f-a657-c34f6b97f3be</name>
-          <entityName>Object_entity</entityName>
-          <fieldName>CampaignSteps</fieldName>
-          <isConsumer v="false" />
-        </entityDependency>
-      </dependencies>
-    </entityProvider>
-    <entityField>
-      <name>CAMPAIGNSTEPID</name>
-      <mandatory v="true" />
-    </entityField>
-    <entityField>
-      <name>CAMPAIGN_ID</name>
-      <title>Campaign</title>
-      <consumer>CampaignConsumer</consumer>
-      <linkedContext>Campaign</linkedContext>
-      <mandatory v="true" />
-      <stateProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/stateProcess.js</stateProcess>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/valueProcess.js</valueProcess>
-      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/displayValueProcess.js</displayValueProcess>
-      <onValueChange>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/onValueChange.js</onValueChange>
-      <onValueChangeTypes>
-        <element>MASK</element>
-        <element>PROCESS_SETVALUE</element>
-      </onValueChangeTypes>
-    </entityField>
-    <entityField>
-      <name>EMPLOYEE_CONTACT_ID</name>
-      <title>Responsible</title>
-      <consumer>Employees</consumer>
-      <mandatory v="true" />
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/employee_contact_id/valueProcess.js</valueProcess>
-      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/employee_contact_id/displayValueProcess.js</displayValueProcess>
-    </entityField>
-    <entityField>
-      <name>NAME</name>
-      <title>Name</title>
-      <mandatory v="true" />
-    </entityField>
-    <entityField>
-      <name>DATE_START</name>
-      <title>Begin</title>
-      <contentType>DATE</contentType>
-      <resolution>DAY</resolution>
-      <outputFormat>dd.MM.yyyy</outputFormat>
-      <inputFormat>dd.MM.yyyy</inputFormat>
-      <mandatory v="true" />
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_start/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>DATE_END</name>
-      <title>End</title>
-      <contentType>DATE</contentType>
-      <resolution>DAY</resolution>
-      <outputFormat>dd.MM.yyyy</outputFormat>
-      <inputFormat>dd.MM.yyyy</inputFormat>
-      <mandatory v="true" />
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_end/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>STATUS</name>
-      <title>Status</title>
-      <consumer>KeywordStates</consumer>
-      <mandatory v="true" />
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/status/valueProcess.js</valueProcess>
-      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/status/displayValueProcess.js</displayValueProcess>
-    </entityField>
-    <entityField>
-      <name>SORTING</name>
-      <title>Sorting</title>
-      <contentType>NUMBER</contentType>
-      <mandatory v="true" />
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/sorting/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>USER_NEW</name>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/user_new/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>DATE_NEW</name>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_new/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>USER_EDIT</name>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/user_edit/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>DATE_EDIT</name>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_edit/valueProcess.js</valueProcess>
-    </entityField>
-    <entityProvider>
-      <name>CampaignSteps</name>
-      <recordContainer>db</recordContainer>
-      <dependencies>
-        <entityDependency>
-          <name>421e6cc2-f874-4834-b022-fe1b253d50af</name>
-          <entityName>Campaign_entity</entityName>
-          <fieldName>CampaignSteps</fieldName>
-          <isConsumer v="false" />
-        </entityDependency>
-        <entityDependency>
-          <name>7f1c046b-0e8f-429e-a0a6-3322382c61d4</name>
-          <entityName>CampaignParticipant_entity</entityName>
-          <fieldName>CampaignSteps</fieldName>
-          <isConsumer v="false" />
-        </entityDependency>
-        <entityDependency>
-          <name>eedc7b17-af98-4ffb-b527-97835cf8f903</name>
-          <entityName>CampaignAddParticipants_entity</entityName>
-          <fieldName>CampaignStepConsumer</fieldName>
-          <isConsumer v="false" />
-        </entityDependency>
-        <entityDependency>
-          <name>ad4ee503-95b9-4add-a0ef-e833db008349</name>
-          <entityName>CampaignCost_entity</entityName>
-          <fieldName>CampaignSteps</fieldName>
-          <isConsumer v="false" />
-        </entityDependency>
-        <entityDependency>
-          <name>3fde1e51-cc4c-4727-b4e7-fd30bed1ee04</name>
-          <entityName>Campaign_entity</entityName>
-          <fieldName>CampaignStepsReadonly</fieldName>
-          <isConsumer v="false" />
-        </entityDependency>
-        <entityDependency>
-          <name>db1a63f3-753b-423d-9ab9-db3d03315dc6</name>
-          <entityName>CampaignStep_entity</entityName>
-          <fieldName>CampaignStepsConsumer</fieldName>
-          <isConsumer v="false" />
-        </entityDependency>
-      </dependencies>
-      <children>
-        <entityParameter>
-          <name>campaignId_param</name>
-          <expose v="true" />
-          <mandatory v="true" />
-        </entityParameter>
-      </children>
-    </entityProvider>
-    <entityParameter>
-      <name>campaignId_param</name>
-      <expose v="true" />
-      <description>PARAMETER</description>
-    </entityParameter>
-    <entityConsumer>
-      <name>KeywordStates</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>KeywordEntry_entity</entityName>
-        <fieldName>SpecificContainerKeywords</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>ContainerName_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/keywordstates/children/containername_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityField>
-      <name>MAXPARTICIPANTS</name>
-      <title>Max participants</title>
-      <contentType>NUMBER</contentType>
-      <mandatory v="true" />
-      <onValidation>%aditoprj%/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js</onValidation>
-    </entityField>
-    <entityConsumer>
-      <name>CampaignParticipantsConsumer</name>
-      <selectionMode>MULTI</selectionMode>
-      <dependency>
-        <name>dependency</name>
-        <entityName>CampaignParticipant_entity</entityName>
-        <fieldName>CampaignParticipantsProvider</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>CampaignId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignparticipantsconsumer/children/campaignid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-        <entityParameter>
-          <name>CampaignStepId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignparticipantsconsumer/children/campaignstepid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityField>
-      <name>CurrentMaxParticipantsInfo</name>
-      <title>Participants</title>
-      <state>READONLY</state>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/currentmaxparticipantsinfo/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>CampaignStatus</name>
-      <title>Campaign status</title>
-      <state>READONLY</state>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstatus/valueProcess.js</valueProcess>
-    </entityField>
-    <entityField>
-      <name>DESCRIPTION</name>
-      <title>Description</title>
-      <contentType>LONG_TEXT</contentType>
-    </entityField>
-    <entityConsumer>
-      <name>Employees</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>Employee_entity</entityName>
-        <fieldName>Employees</fieldName>
-      </dependency>
-    </entityConsumer>
-    <entityConsumer>
-      <name>CampaignStepCosts</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>CampaignCost_entity</entityName>
-        <fieldName>StepCosts</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>CampaignId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepcosts/children/campaignid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-        <entityParameter>
-          <name>CampaignStepId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepcosts/children/campaignstepid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityField>
-      <name>COST</name>
-      <title>Cost</title>
-      <contentType>NUMBER</contentType>
-      <outputFormat>#,##0.00</outputFormat>
-      <inputFormat>#,##0.00</inputFormat>
-    </entityField>
-    <entityConsumer>
-      <name>CampaignConsumer</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>Campaign_entity</entityName>
-        <fieldName>Campaigns</fieldName>
-      </dependency>
-    </entityConsumer>
-    <entityConsumer>
-      <name>Activities</name>
-      <title>Activities</title>
-      <dependency>
-        <name>dependency</name>
-        <entityName>Activity_entity</entityName>
-        <fieldName>LinkedObjects</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>RowId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/activities/children/rowid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-        <entityParameter>
-          <name>ObjectId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/activities/children/objectid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityConsumer>
-      <name>Tasks</name>
-      <title>Tasks</title>
-      <stateProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/tasks/stateProcess.js</stateProcess>
-      <dependency>
-        <name>dependency</name>
-        <entityName>Task_entity</entityName>
-        <fieldName>Tasks</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>RowId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/tasks/children/rowid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-        <entityParameter>
-          <name>ObjectId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/tasks/children/objectid_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityActionField>
-      <name>newActivity</name>
-      <title>New activity</title>
-      <onActionProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newactivity/onActionProcess.js</onActionProcess>
-      <iconId>VAADIN:HOURGLASS</iconId>
-      <tooltip>New activity</tooltip>
-      <tooltipProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newactivity/tooltipProcess.js</tooltipProcess>
-    </entityActionField>
-    <entityActionField>
-      <name>newTask</name>
-      <title>New task</title>
-      <onActionProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newtask/onActionProcess.js</onActionProcess>
-      <iconId>VAADIN:TASKS</iconId>
-    </entityActionField>
-    <entityField>
-      <name>PREDECESSORSTEP_ID</name>
-      <title>Predecessor</title>
-      <color></color>
-      <consumer>CampaignStepsConsumer</consumer>
-      <textInputAllowed v="true" />
-      <stateProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/predecessorstep_id/stateProcess.js</stateProcess>
-      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/predecessorstep_id/displayValueProcess.js</displayValueProcess>
-      <onValueChangeTypes>
-        <element>MASK</element>
-        <element>PROCESS</element>
-        <element>PROCESS_SETVALUE</element>
-      </onValueChangeTypes>
-    </entityField>
-    <entityConsumer>
-      <name>CampaignStepsConsumer</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>CampaignStep_entity</entityName>
-        <fieldName>CampaignSteps</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>campaignId_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/campaignid_param/valueProcess.js</valueProcess>
-          <mandatory v="true" />
-        </entityParameter>
-        <entityParameter>
-          <name>maxSort_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js</valueProcess>
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityField>
-      <name>CampaignName</name>
-      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignname/valueProcess.js</valueProcess>
-    </entityField>
-    <entityParameter>
-      <name>campaignSelectionVisible_param</name>
-      <expose v="true" />
-      <description>PARAMETER</description>
-    </entityParameter>
-    <entityConsumer>
-      <name>CampaignStepMedium</name>
-      <dependency>
-        <name>dependency</name>
-        <entityName>KeywordEntry_entity</entityName>
-        <fieldName>SpecificContainerKeywords</fieldName>
-      </dependency>
-      <children>
-        <entityParameter>
-          <name>ContainerName_param</name>
-          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepmedium/children/containername_param/valueProcess.js</valueProcess>
-          <expose v="false" />
-        </entityParameter>
-      </children>
-    </entityConsumer>
-    <entityField>
-      <name>STEPMEDIUM</name>
-      <title>Medium</title>
-      <consumer>CampaignStepMedium</consumer>
-      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/stepmedium/displayValueProcess.js</displayValueProcess>
-    </entityField>
-    <entityActionField>
-      <name>newBulkMail</name>
-      <title>Write bulk mail</title>
-      <onActionProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newbulkmail/onActionProcess.js</onActionProcess>
-      <iconId>VAADIN:AT</iconId>
-    </entityActionField>
-    <entityParameter>
-      <name>maxSort_param</name>
-      <expose v="true" />
-    </entityParameter>
-  </entityFields>
-  <recordContainers>
-    <dbRecordContainer>
-      <name>db</name>
-      <alias>Data_alias</alias>
-      <conditionProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
-      <orderClauseProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
-      <linkInformation>
-        <linkInformation>
-          <name>b039db2c-3988-42a0-9257-9689b1eb4e58</name>
-          <tableName>CAMPAIGNSTEP</tableName>
-          <primaryKey>CAMPAIGNSTEPID</primaryKey>
-          <isUIDTable v="true" />
-          <readonly v="false" />
-        </linkInformation>
-      </linkInformation>
-      <recordFieldMappings>
-        <dbRecordFieldMapping>
-          <name>CAMPAIGN_ID.value</name>
-          <recordfield>CAMPAIGNSTEP.CAMPAIGN_ID</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>DATE_EDIT.value</name>
-          <recordfield>CAMPAIGNSTEP.DATE_EDIT</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>DATE_END.value</name>
-          <recordfield>CAMPAIGNSTEP.DATE_END</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>DATE_NEW.value</name>
-          <recordfield>CAMPAIGNSTEP.DATE_NEW</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>DATE_START.value</name>
-          <recordfield>CAMPAIGNSTEP.DATE_START</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>EMPLOYEE_CONTACT_ID.value</name>
-          <recordfield>CAMPAIGNSTEP.EMPLOYEE_CONTACT_ID</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>NAME.value</name>
-          <recordfield>CAMPAIGNSTEP.NAME</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>SORTING.value</name>
-          <recordfield>CAMPAIGNSTEP.SORTING</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>STATUS.value</name>
-          <recordfield>CAMPAIGNSTEP.STATUS</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>USER_EDIT.value</name>
-          <recordfield>CAMPAIGNSTEP.USER_EDIT</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>USER_NEW.value</name>
-          <recordfield>CAMPAIGNSTEP.USER_NEW</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>STATUS.displayValue</name>
-          <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>MAXPARTICIPANTS.value</name>
-          <recordfield>CAMPAIGNSTEP.MAXPARTICIPANTS</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>CAMPAIGNSTEPID.value</name>
-          <recordfield>CAMPAIGNSTEP.CAMPAIGNSTEPID</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>DESCRIPTION.value</name>
-          <recordfield>CAMPAIGNSTEP.DESCRIPTION</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>COST.value</name>
-          <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/cost.value/expression.js</expression>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>CAMPAIGN_ID.displayValue</name>
-          <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/campaign_id.displayvalue/expression.js</expression>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>PREDECESSORSTEP_ID.value</name>
-          <recordfield>CAMPAIGNSTEP.PREDECESSORSTEP_ID</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>STEPMEDIUM.value</name>
-          <recordfield>CAMPAIGNSTEP.STEPMEDIUM</recordfield>
-        </dbRecordFieldMapping>
-      </recordFieldMappings>
-    </dbRecordContainer>
-  </recordContainers>
-</entity>
+<?xml version="1.0" encoding="UTF-8"?>
+<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.11" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.11">
+  <name>CampaignStep_entity</name>
+  <majorModelMode>DISTRIBUTED</majorModelMode>
+  <icon>NEON:GROUP_APPOINTMENT</icon>
+  <title>Campaign Step</title>
+  <siblings>
+    <element>CampaignPlanning_entity</element>
+    <element>Campaign_entity</element>
+  </siblings>
+  <grantDeleteProcess>%aditoprj%/entity/CampaignStep_entity/grantDeleteProcess.js</grantDeleteProcess>
+  <contentTitleProcess>%aditoprj%/entity/CampaignStep_entity/contentTitleProcess.js</contentTitleProcess>
+  <onValidation>%aditoprj%/entity/CampaignStep_entity/onValidation.js</onValidation>
+  <imageProcess>%aditoprj%/entity/CampaignStep_entity/imageProcess.js</imageProcess>
+  <titlePlural>Steps</titlePlural>
+  <recordContainer>db</recordContainer>
+  <entityFields>
+    <entityProvider>
+      <name>#PROVIDER</name>
+      <dependencies>
+        <entityDependency>
+          <name>13f82959-7e04-449f-a657-c34f6b97f3be</name>
+          <entityName>Object_entity</entityName>
+          <fieldName>CampaignSteps</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+      </dependencies>
+    </entityProvider>
+    <entityField>
+      <name>CAMPAIGNSTEPID</name>
+      <mandatory v="true" />
+    </entityField>
+    <entityField>
+      <name>CAMPAIGN_ID</name>
+      <title>Campaign</title>
+      <consumer>CampaignConsumer</consumer>
+      <linkedContext>Campaign</linkedContext>
+      <mandatory v="true" />
+      <stateProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/stateProcess.js</stateProcess>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/valueProcess.js</valueProcess>
+      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/displayValueProcess.js</displayValueProcess>
+      <onValueChange>%aditoprj%/entity/CampaignStep_entity/entityfields/campaign_id/onValueChange.js</onValueChange>
+      <onValueChangeTypes>
+        <element>MASK</element>
+        <element>PROCESS_SETVALUE</element>
+      </onValueChangeTypes>
+    </entityField>
+    <entityField>
+      <name>EMPLOYEE_CONTACT_ID</name>
+      <title>Responsible</title>
+      <consumer>Employees</consumer>
+      <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/employee_contact_id/valueProcess.js</valueProcess>
+      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/employee_contact_id/displayValueProcess.js</displayValueProcess>
+    </entityField>
+    <entityField>
+      <name>NAME</name>
+      <title>Name</title>
+      <mandatory v="true" />
+    </entityField>
+    <entityField>
+      <name>DATE_START</name>
+      <title>Begin</title>
+      <contentType>DATE</contentType>
+      <resolution>DAY</resolution>
+      <outputFormat>dd.MM.yyyy</outputFormat>
+      <inputFormat>dd.MM.yyyy</inputFormat>
+      <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_start/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>DATE_END</name>
+      <title>End</title>
+      <contentType>DATE</contentType>
+      <resolution>DAY</resolution>
+      <outputFormat>dd.MM.yyyy</outputFormat>
+      <inputFormat>dd.MM.yyyy</inputFormat>
+      <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_end/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>STATUS</name>
+      <title>Status</title>
+      <consumer>KeywordStates</consumer>
+      <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/status/valueProcess.js</valueProcess>
+      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/status/displayValueProcess.js</displayValueProcess>
+    </entityField>
+    <entityField>
+      <name>SORTING</name>
+      <title>Sorting</title>
+      <contentType>NUMBER</contentType>
+      <mandatory v="true" />
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/sorting/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>USER_NEW</name>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/user_new/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>DATE_NEW</name>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_new/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>USER_EDIT</name>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/user_edit/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>DATE_EDIT</name>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/date_edit/valueProcess.js</valueProcess>
+    </entityField>
+    <entityProvider>
+      <name>CampaignSteps</name>
+      <recordContainer>db</recordContainer>
+      <dependencies>
+        <entityDependency>
+          <name>421e6cc2-f874-4834-b022-fe1b253d50af</name>
+          <entityName>Campaign_entity</entityName>
+          <fieldName>CampaignSteps</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+        <entityDependency>
+          <name>7f1c046b-0e8f-429e-a0a6-3322382c61d4</name>
+          <entityName>CampaignParticipant_entity</entityName>
+          <fieldName>CampaignSteps</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+        <entityDependency>
+          <name>eedc7b17-af98-4ffb-b527-97835cf8f903</name>
+          <entityName>CampaignAddParticipants_entity</entityName>
+          <fieldName>CampaignStepConsumer</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+        <entityDependency>
+          <name>ad4ee503-95b9-4add-a0ef-e833db008349</name>
+          <entityName>CampaignCost_entity</entityName>
+          <fieldName>CampaignSteps</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+        <entityDependency>
+          <name>3fde1e51-cc4c-4727-b4e7-fd30bed1ee04</name>
+          <entityName>Campaign_entity</entityName>
+          <fieldName>CampaignStepsReadonly</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+        <entityDependency>
+          <name>db1a63f3-753b-423d-9ab9-db3d03315dc6</name>
+          <entityName>CampaignStep_entity</entityName>
+          <fieldName>CampaignStepsConsumer</fieldName>
+          <isConsumer v="false" />
+        </entityDependency>
+      </dependencies>
+      <children>
+        <entityParameter>
+          <name>campaignId_param</name>
+          <expose v="true" />
+          <mandatory v="true" />
+        </entityParameter>
+      </children>
+    </entityProvider>
+    <entityParameter>
+      <name>campaignId_param</name>
+      <expose v="true" />
+      <description>PARAMETER</description>
+    </entityParameter>
+    <entityConsumer>
+      <name>KeywordStates</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>KeywordEntry_entity</entityName>
+        <fieldName>SpecificContainerKeywords</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ContainerName_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/keywordstates/children/containername_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityField>
+      <name>MAXPARTICIPANTS</name>
+      <title>Max participants</title>
+      <contentType>NUMBER</contentType>
+      <mandatory v="true" />
+      <onValidation>%aditoprj%/entity/CampaignStep_entity/entityfields/maxparticipants/onValidation.js</onValidation>
+    </entityField>
+    <entityConsumer>
+      <name>CampaignParticipantsConsumer</name>
+      <selectionMode>MULTI</selectionMode>
+      <dependency>
+        <name>dependency</name>
+        <entityName>CampaignParticipant_entity</entityName>
+        <fieldName>CampaignParticipantsProvider</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>CampaignId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignparticipantsconsumer/children/campaignid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>CampaignStepId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignparticipantsconsumer/children/campaignstepid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityField>
+      <name>CurrentMaxParticipantsInfo</name>
+      <title>Participants</title>
+      <state>READONLY</state>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/currentmaxparticipantsinfo/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>CampaignStatus</name>
+      <title>Campaign status</title>
+      <state>READONLY</state>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstatus/valueProcess.js</valueProcess>
+    </entityField>
+    <entityField>
+      <name>DESCRIPTION</name>
+      <title>Description</title>
+      <contentType>LONG_TEXT</contentType>
+    </entityField>
+    <entityConsumer>
+      <name>Employees</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Employee_entity</entityName>
+        <fieldName>Employees</fieldName>
+      </dependency>
+    </entityConsumer>
+    <entityConsumer>
+      <name>CampaignStepCosts</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>CampaignCost_entity</entityName>
+        <fieldName>StepCosts</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>CampaignId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepcosts/children/campaignid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>CampaignStepId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepcosts/children/campaignstepid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityField>
+      <name>COST</name>
+      <title>Cost</title>
+      <contentType>NUMBER</contentType>
+      <outputFormat>#,##0.00</outputFormat>
+      <inputFormat>#,##0.00</inputFormat>
+    </entityField>
+    <entityConsumer>
+      <name>CampaignConsumer</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Campaign_entity</entityName>
+        <fieldName>Campaigns</fieldName>
+      </dependency>
+    </entityConsumer>
+    <entityConsumer>
+      <name>Activities</name>
+      <title>Activities</title>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Activity_entity</entityName>
+        <fieldName>LinkedObjects</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>RowId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/activities/children/rowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/activities/children/objectid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityConsumer>
+      <name>Tasks</name>
+      <title>Tasks</title>
+      <stateProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/tasks/stateProcess.js</stateProcess>
+      <dependency>
+        <name>dependency</name>
+        <entityName>Task_entity</entityName>
+        <fieldName>Tasks</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>RowId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/tasks/children/rowid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+        <entityParameter>
+          <name>ObjectId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/tasks/children/objectid_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityActionField>
+      <name>newActivity</name>
+      <title>New activity</title>
+      <onActionProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newactivity/onActionProcess.js</onActionProcess>
+      <iconId>VAADIN:HOURGLASS</iconId>
+      <tooltip>New activity</tooltip>
+      <tooltipProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newactivity/tooltipProcess.js</tooltipProcess>
+    </entityActionField>
+    <entityActionField>
+      <name>newTask</name>
+      <title>New task</title>
+      <onActionProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newtask/onActionProcess.js</onActionProcess>
+      <iconId>VAADIN:TASKS</iconId>
+    </entityActionField>
+    <entityField>
+      <name>PREDECESSORSTEP_ID</name>
+      <title>Predecessor</title>
+      <color></color>
+      <consumer>CampaignStepsConsumer</consumer>
+      <textInputAllowed v="true" />
+      <stateProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/predecessorstep_id/stateProcess.js</stateProcess>
+      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/predecessorstep_id/displayValueProcess.js</displayValueProcess>
+      <onValueChangeTypes>
+        <element>MASK</element>
+        <element>PROCESS</element>
+        <element>PROCESS_SETVALUE</element>
+      </onValueChangeTypes>
+    </entityField>
+    <entityConsumer>
+      <name>CampaignStepsConsumer</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>CampaignStep_entity</entityName>
+        <fieldName>CampaignSteps</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>campaignId_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/campaignid_param/valueProcess.js</valueProcess>
+          <mandatory v="true" />
+        </entityParameter>
+        <entityParameter>
+          <name>maxSort_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js</valueProcess>
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityField>
+      <name>CampaignName</name>
+      <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignname/valueProcess.js</valueProcess>
+    </entityField>
+    <entityParameter>
+      <name>campaignSelectionVisible_param</name>
+      <expose v="true" />
+      <description>PARAMETER</description>
+    </entityParameter>
+    <entityConsumer>
+      <name>CampaignStepMedium</name>
+      <dependency>
+        <name>dependency</name>
+        <entityName>KeywordEntry_entity</entityName>
+        <fieldName>SpecificContainerKeywords</fieldName>
+      </dependency>
+      <children>
+        <entityParameter>
+          <name>ContainerName_param</name>
+          <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepmedium/children/containername_param/valueProcess.js</valueProcess>
+          <expose v="false" />
+        </entityParameter>
+      </children>
+    </entityConsumer>
+    <entityField>
+      <name>STEPMEDIUM</name>
+      <title>Medium</title>
+      <consumer>CampaignStepMedium</consumer>
+      <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/stepmedium/displayValueProcess.js</displayValueProcess>
+    </entityField>
+    <entityActionField>
+      <name>newBulkMail</name>
+      <title>Write bulk mail</title>
+      <onActionProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/newbulkmail/onActionProcess.js</onActionProcess>
+      <iconId>VAADIN:AT</iconId>
+    </entityActionField>
+    <entityParameter>
+      <name>maxSort_param</name>
+      <expose v="true" />
+    </entityParameter>
+  </entityFields>
+  <recordContainers>
+    <dbRecordContainer>
+      <name>db</name>
+      <alias>Data_alias</alias>
+      <conditionProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
+      <orderClauseProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
+      <linkInformation>
+        <linkInformation>
+          <name>b039db2c-3988-42a0-9257-9689b1eb4e58</name>
+          <tableName>CAMPAIGNSTEP</tableName>
+          <primaryKey>CAMPAIGNSTEPID</primaryKey>
+          <isUIDTable v="true" />
+          <readonly v="false" />
+        </linkInformation>
+      </linkInformation>
+      <recordFieldMappings>
+        <dbRecordFieldMapping>
+          <name>CAMPAIGN_ID.value</name>
+          <recordfield>CAMPAIGNSTEP.CAMPAIGN_ID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_EDIT.value</name>
+          <recordfield>CAMPAIGNSTEP.DATE_EDIT</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_END.value</name>
+          <recordfield>CAMPAIGNSTEP.DATE_END</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_NEW.value</name>
+          <recordfield>CAMPAIGNSTEP.DATE_NEW</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DATE_START.value</name>
+          <recordfield>CAMPAIGNSTEP.DATE_START</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>EMPLOYEE_CONTACT_ID.value</name>
+          <recordfield>CAMPAIGNSTEP.EMPLOYEE_CONTACT_ID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>NAME.value</name>
+          <recordfield>CAMPAIGNSTEP.NAME</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>SORTING.value</name>
+          <recordfield>CAMPAIGNSTEP.SORTING</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>STATUS.value</name>
+          <recordfield>CAMPAIGNSTEP.STATUS</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USER_EDIT.value</name>
+          <recordfield>CAMPAIGNSTEP.USER_EDIT</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>USER_NEW.value</name>
+          <recordfield>CAMPAIGNSTEP.USER_NEW</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>STATUS.displayValue</name>
+          <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>MAXPARTICIPANTS.value</name>
+          <recordfield>CAMPAIGNSTEP.MAXPARTICIPANTS</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CAMPAIGNSTEPID.value</name>
+          <recordfield>CAMPAIGNSTEP.CAMPAIGNSTEPID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>DESCRIPTION.value</name>
+          <recordfield>CAMPAIGNSTEP.DESCRIPTION</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>COST.value</name>
+          <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/cost.value/expression.js</expression>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>CAMPAIGN_ID.displayValue</name>
+          <expression>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/recordfieldmappings/campaign_id.displayvalue/expression.js</expression>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>PREDECESSORSTEP_ID.value</name>
+          <recordfield>CAMPAIGNSTEP.PREDECESSORSTEP_ID</recordfield>
+        </dbRecordFieldMapping>
+        <dbRecordFieldMapping>
+          <name>STEPMEDIUM.value</name>
+          <recordfield>CAMPAIGNSTEP.STEPMEDIUM</recordfield>
+        </dbRecordFieldMapping>
+      </recordFieldMappings>
+    </dbRecordContainer>
+  </recordContainers>
+</entity>
diff --git a/entity/CampaignStep_entity/grantDeleteProcess.js b/entity/CampaignStep_entity/grantDeleteProcess.js
new file mode 100644
index 0000000000000000000000000000000000000000..87f22c8c68e951b1986bc106010ce589753244be
--- /dev/null
+++ b/entity/CampaignStep_entity/grantDeleteProcess.js
@@ -0,0 +1,7 @@
+import("Context_lib");
+import("system.vars");
+import("ActivityTask_lib");
+import("system.result");
+
+result.string(!TaskUtils.hasTasks(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNSTEPID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Campaign_entity/grantDeleteProcess.js b/entity/Campaign_entity/grantDeleteProcess.js
index 6ee8a7b39c1303eb1fb8b9002b273b3b17fa9025..8f6dbd3f5f48448ca0c78b7240fbbd715828a6bd 100644
--- a/entity/Campaign_entity/grantDeleteProcess.js
+++ b/entity/Campaign_entity/grantDeleteProcess.js
@@ -1,5 +1,9 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("CAMPAIGN", null, vars.get("$field.CAMPAIGNID")));
\ No newline at end of file
+result.string(!DocumentUtil.hasDocuments("CAMPAIGN", null, vars.get("$field.CAMPAIGNID"))
+    && !TaskUtils.hasTasks(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.CAMPAIGNID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Contract_entity/grantDeleteProcess.js b/entity/Contract_entity/grantDeleteProcess.js
index d22540f0318c8083cc2330daf02b463f0cec08f2..36b39de07882145d3528ad277b799a36d79c4a6e 100644
--- a/entity/Contract_entity/grantDeleteProcess.js
+++ b/entity/Contract_entity/grantDeleteProcess.js
@@ -1,5 +1,9 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("CONTRACT", null, vars.get("$field.CONTRACTID")));
\ No newline at end of file
+result.string(!DocumentUtil.hasDocuments("CONTRACT", null, vars.get("$field.CONTRACTID"))
+    && !TaskUtils.hasTasks(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.CONTRACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Offer_entity/grantDeleteProcess.js b/entity/Offer_entity/grantDeleteProcess.js
index d71156a6e733c9be4c8b66a34844ddf899d1a9b2..287fe5261292fbc1d33f3a86cd673877ff688166 100644
--- a/entity/Offer_entity/grantDeleteProcess.js
+++ b/entity/Offer_entity/grantDeleteProcess.js
@@ -1,6 +1,11 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 import("Offer_lib");
 
-result.string(OfferUtils.isDeletable(vars.get("$field.STATUS")) && !DocumentUtil.hasDocuments("OFFER", null, vars.get("$field.OFFERID")));
\ No newline at end of file
+result.string(OfferUtils.isDeletable(vars.get("$field.STATUS")) 
+    && !DocumentUtil.hasDocuments("OFFER", null, vars.get("$field.OFFERID"))
+    && !TaskUtils.hasTasks(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.OFFERID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Order_entity/grantDeleteProcess.js b/entity/Order_entity/grantDeleteProcess.js
index 5771a55f52fb23696581f0c7010da37521a61e60..c869b71df47f48eb14648ab83bf80b4f2f507da9 100644
--- a/entity/Order_entity/grantDeleteProcess.js
+++ b/entity/Order_entity/grantDeleteProcess.js
@@ -1,5 +1,9 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("SALESORDER", null, vars.get("$field.SALESORDERID")));
\ No newline at end of file
+result.string(!DocumentUtil.hasDocuments("SALESORDER", null, vars.get("$field.SALESORDERID"))
+    && !TaskUtils.hasTasks(vars.get("$field.SALESORDERID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.SALESORDERID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Organisation_entity/grantDeleteProcess.js b/entity/Organisation_entity/grantDeleteProcess.js
index 1407fae5d329753dfe447a9b6cad6e264aecfbf2..c4ebf40c41f7ba44d1ff79e91b77b0487c59475f 100644
--- a/entity/Organisation_entity/grantDeleteProcess.js
+++ b/entity/Organisation_entity/grantDeleteProcess.js
@@ -1,5 +1,9 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID")));
\ No newline at end of file
+result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID"))
+    && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Person_entity/grantDeleteProcess.js b/entity/Person_entity/grantDeleteProcess.js
index 1407fae5d329753dfe447a9b6cad6e264aecfbf2..c4ebf40c41f7ba44d1ff79e91b77b0487c59475f 100644
--- a/entity/Person_entity/grantDeleteProcess.js
+++ b/entity/Person_entity/grantDeleteProcess.js
@@ -1,5 +1,9 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID")));
\ No newline at end of file
+result.string(!DocumentUtil.hasDocuments("CONTACT", null, vars.get("$field.CONTACTID"))
+    && !TaskUtils.hasTasks(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.CONTACTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Product_entity/grantDeleteProcess.js b/entity/Product_entity/grantDeleteProcess.js
index e57083a848501cfa612c6303d835d9a3a2a71d3d..e60a76ed2f3b62ed97948d8cf55819dc835f59fa 100644
--- a/entity/Product_entity/grantDeleteProcess.js
+++ b/entity/Product_entity/grantDeleteProcess.js
@@ -1,5 +1,8 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("PRODUCT", null, vars.get("$field.PRODUCTID")));
\ No newline at end of file
+result.string(!DocumentUtil.hasDocuments("PRODUCT", null, vars.get("$field.PRODUCTID"))
+    && !ActivityUtils.hasActivities(vars.get("$field.PRODUCTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/entity/Salesproject_entity/grantDeleteProcess.js b/entity/Salesproject_entity/grantDeleteProcess.js
index 838bcbd9f3aecf3ad6adc53c1570e0c70cd46c57..66d8dcc67dbfa7addfbe250d3e1c6a074bb84a3a 100644
--- a/entity/Salesproject_entity/grantDeleteProcess.js
+++ b/entity/Salesproject_entity/grantDeleteProcess.js
@@ -1,5 +1,9 @@
+import("Context_lib");
+import("ActivityTask_lib");
 import("Document_lib");
 import("system.vars");
 import("system.result");
 
-result.string(!DocumentUtil.hasDocuments("SALESPROJECT", null, vars.get("$field.SALESPROJECTID")));
\ No newline at end of file
+result.string(!DocumentUtil.hasDocuments("SALESPROJECT", null, vars.get("$field.SALESPROJECTID"))
+    && !TaskUtils.hasTasks(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId())
+    && !ActivityUtils.hasActivities(vars.get("$field.SALESPROJECTID"), ContextUtils.getCurrentContextId()));
\ No newline at end of file
diff --git a/process/ActivityTask_lib/process.js b/process/ActivityTask_lib/process.js
index 56174a6a884885858ea8cdf9f3d28c6f4169c9ed..3987c9533e07e9ca7a30e8f5bf68e0035a4900b9 100644
--- a/process/ActivityTask_lib/process.js
+++ b/process/ActivityTask_lib/process.js
@@ -1,339 +1,353 @@
-import("system.logging");
-import("Binary_lib");
-import("system.vars");
-import("system.util");
-import("system.datetime");
-import("system.text");
-import("system.neon");
-import("system.db");
-import("system.translate");
-import("system.eMath");
-import("Util_lib");
-import("Sql_lib");
-import("Keyword_lib");
-import("KeywordRegistry_basic");
-import("Product_lib");
-import("Report_lib");
-import("Context_lib");
-
-/**
- * Methods used by for activities (former history).
- * Do not create an instance of this!
- * 
- * @class
- */
-function ActivityUtils() {}
-
-/**
- * Create a new activity within the database-scope.
- * This funciton will insert a complete new activity into the Database
- * 
- * @param {Object} [pDataPreset={}] an object that contains the data for the activity, you do not need to specify any preset data at all,
- *                                  but you CAN define the following properties: 
- *                                  <ul>
- *                                  <li>activityId</li>
- *                                  <li>responsibleContactId</li>
- *                                  <li>categoryKeywordId</li>
- *                                  <li>directionKeywordId</li>
- *                                  <li>subject</li>
- *                                  <li>content</li>
- *                                  </ul>
- * @param {Array} [pActivityLinks] 2D array where each element is an array of Contextname and objectid, for example:
- *                                 <pre>[["Organisation", "2d1e505c-a75a-4fa6-826b-7224a97d5b51"]]</pre>
-  * @param {Array} [pDocuments] 2D array where each element is an array of:
-   *                                <ul>
- *                                  <li>document-name</li>
- *                                  <li>document-content(base64-string)</li>
- *                                  <li>true/false if it's mainDocument or not</li>
- *                                  </ul>
- *                                  for example:
- *                                  <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre>
- * @param {String} [pDbAlias=current db alias] database alias where the activity shall be inserted
- * 
- * @return {Object} js object where the following are filled:
- *                                  <ul>
- *                                  <li>activityId</li>
- *                                  </ul>
- */
-ActivityUtils.insertNewActivity = function(pDataPreset, pActivityLinks, pDocuments, pDbAlias)
-{
-    var dataPreset = pDataPreset || {};
-    var dbAlias = pDbAlias || db.getCurrentAlias();
-    var insertStatements = [];
-    
-    var creationUser = vars.get("$sys.user");
-    var creationDate = datetime.date();
-    
-    var activityId = dataPreset.activityId || util.getNewUUID();
-    var entrydate = pDataPreset.entrydate || creationDate;
-
-    var activityColumns = ["ACTIVITYID", "DATE_NEW", "USER_NEW", "ENTRYDATE"];
-    var activityValues = [activityId, creationDate, creationUser, entrydate];
-    
-    _addActivityCol("CATEGORY", dataPreset.categoryKeywordId);
-    _addActivityCol("DIRECTION", dataPreset.directionKeywordId);
-    _addActivityCol("INFO", dataPreset.content);
-    _addActivityCol("RESPONSIBLE", dataPreset.responsibleContactId);
-    _addActivityCol("SUBJECT", dataPreset.subject);
-    
-    insertStatements.push(["ACTIVITY", activityColumns, db.getColumnTypes("ACTIVITY", activityColumns, dbAlias), activityValues]);
-
-    if (pActivityLinks)
-    {
-        var activityLinkColumns = ["ACTIVITYLINKID", "ACTIVITY_ID", "DATE_NEW", "USER_NEW", "OBJECT_TYPE", "OBJECT_ROWID"];
-        var activityLinkColumnTypes = db.getColumnTypes("ACTIVITYLINK", activityLinkColumns, dbAlias);
-        var activityLinkValues;
-        for (var i = 0, l = pActivityLinks.length; i < l; i++)
-        {
-            activityLinkValues = [util.getNewUUID(), activityId, creationDate, creationUser, pActivityLinks[i][0], pActivityLinks[i][1]];
-            insertStatements.push(["ACTIVITYLINK", activityLinkColumns, activityLinkColumnTypes, activityLinkValues]);
-        }
-    }
-    
-    db.inserts(insertStatements, dbAlias);
-    
-    if (pDocuments)
-        ActivityUtils.insertDocuments(activityId, pDocuments);
-
-    return {
-        activityId: activityId
-    };
-
-    function _addActivityCol(pColumn, pValue, pDefaultValue)
-    {
-        if (pValue || pDefaultValue)
-        {
-            activityColumns.push(pColumn);
-            activityValues.push(pValue || pDefaultValue);
-        }
-    }
-};
-
-/**
- * inserts documents for an activity
- * 
- * @param {String} pActivityId activity id
- * @param {Array} pDocuments 2D array where each element is an array of:
- *                                  <ul>
- *                                  <li>document-name</li>
- *                                  <li>document-content(base64-string)</li>
- *                                  <li>true/false if it's mainDocument or not</li>
- *                                  </ul>
- *                                  for example:
- *                                  <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre>
- */
-ActivityUtils.insertDocuments = function (pActivityId, pDocuments)
-{
-    pDocuments.forEach(function (document)
-    {
-        var filename, b64Content, isMainDocument;
-        [filename, b64Content, isMainDocument] = document;
-        if (isMainDocument)
-            SingleBinaryUtils.insertMainDocument("ACTIVITY", "DOCUMENT", pActivityId, b64Content, filename);
-        else
-            SingleBinaryUtils.insert("ACTIVITY", "DOCUMENT", pActivityId, b64Content, filename);
-    });
-}
-
-/**
- * Create a new activity
- */
-ActivityUtils.createNewActivity = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pSubject, pInfo, pDirection, pDocuments)
-{
-    var params = {};
-    if (pDocuments)
-        params["PresetDocuments_param"] = JSON.stringify(pDocuments);
-    if (pSubject)
-        params["Subject_param"] = pSubject;
-    if (pInfo)
-        params["Info_param"] = text.text2html(pInfo.trim(), false);
-    if (pDirection)
-        params["Direction_param"] = pDirection;
-    
-    _ActivityTaskUtils._createNew("Activity", pRowId, pAdditionalLinks, pParentContext, pParentId, params)
-}
-
-/*
- * Gets the date of the last activity
- * 
- * @param {String} pRowId the rowid of the dataset
- * 
- * @return {number|null} the date of the last actvity as long
- */
-ActivityUtils.getLastActivityDate = function(pRowId)
-{
-    var context = ContextUtils.getCurrentContextId();
-    var sqlUtil = new SqlMaskingUtils();
-    var activitySql = "select " + sqlUtil.max("ENTRYDATE") + " from ACTIVITY "
-        + " join ACTIVITYLINK on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID";
-    activitySql = SqlCondition.begin()
-        .andPrepare("ACTIVITYLINK.OBJECT_TYPE", context)
-        .andPrepare("ACTIVITYLINK.OBJECT_ROWID", pRowId)
-        .buildSql(activitySql);
-    
-    var entryDate = db.cell(activitySql);
-    if (entryDate != "")
-        return parseInt(entryDate);
-    return null;
-}
-
-/**
- * add the links to the link-table in new mode
- * 
- * @return {String} pObjectIdField jdito Field for the objectId
- * @return {String} pRowIdField jdito Field for the rowId
- * @return {String} pAdditionalLinksField jdito Field for additional links
- */
-ActivityUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField)
-{
-    _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links");
-}
-
-/**
- * Methods used by for tasks.
- * Do not create an instance of this!
- * 
- * @class
- */
-function TaskUtils () {}
-   
-
-/**
- * Create a new task
- */
-TaskUtils.createNewTask = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pParams, pDocuments)
-{
-    _ActivityTaskUtils._createNew("Task", pRowId, pAdditionalLinks, pParentContext, pParentId, pParams, pDocuments)
-}
-
-/**
- * Create a new task
- */
-TaskUtils.hasTasks = function(pRowId, pObjectType)
-{
-    if (pRowId != "" && pObjectType != "")
-    {
-        var cond = SqlCondition.begin().andPrepare("TASKLINK.OBJECT_TYPE", pObjectType)
-                                       .andPrepare("TASKLINK.OBJECT_ROWID", pRowId);
-        var taskCount = db.cell(cond.buildSql("select count(*) from TASKLINK"));
-        if (taskCount != "0")
-            return true;
-        else 
-            return false;
-    }
-    else
-        return true;
-}
-
-TaskUtils.getStatusIcon = function(pStatus)
-{
-    return KeywordUtils.getAttributeRelation(pStatus, $KeywordRegistry.taskStatus(), "icon", "NEON:STATUS_NOT_STARTED");
-}
-
-/**
- * add the links to the link-table in new mode
- * 
- * @return {String} pObjectIdField jdito Field for the objectId
- * @return {String} pRowIdField jdito Field for the rowId
- * @return {String} pAdditionalLinksField jdito Field for additional links
- */
-TaskUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField)
-{
-    _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links");
-}
-
-/**
- * Methods used by for tasks.
- * Do not create an instance of this!
- * 
- * @ignore
- * @class
- */
-function _ActivityTaskUtils() {}
-   
-
-/**
- * Create a new task
- * @ignore
- */
-_ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pParentContext, pParentId, pParams)
-{
-    if (pAdditionalLinks == undefined)
-        pAdditionalLinks = [];
-       
-    var params = {};
-    
-    if (pParams)
-        params = pParams
-     
-    if (pRowId)
-    {
-        params["ObjectId_param"] = ContextUtils.getCurrentContextId();
-        params["RowId_param"] = pRowId;
-    }
-        
-    params["PresetLinks_param"] = JSON.stringify(pAdditionalLinks);
-    
-    if (pParentContext && pParentId)
-    {
-        
-        
-        params["ParentContext_param"] = pParentContext;
-        params["ParentId_param"] = pParentId;
-    }
-    
-    neon.openContext(pContext, null, null, neon.OPERATINGSTATE_NEW, params);
-}
-
-/**
- * add the links to the link-table in new mode
- * 
- * @return {String} pObjectIdField jdito Field for the objectId
- * @return {String} pRowIdField jdito Field for the rowId
- * @return {String} pAdditionalLinksField jdito Field for additional links
- * 
- * @ignore
- */
-_ActivityTaskUtils._addLinkRecords = function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, pConsumerName)
-{
-    if (vars.exists(pAdditionalLinksField))
-        presetLinks = JSON.parse(vars.getString(pAdditionalLinksField));
-
-    if (!presetLinks)
-        presetLinks = [];
-    
-    if (vars.exists(pRowIdField) && vars.get(pRowIdField)
-        && vars.exists(pObjectIdField) && vars.get(pObjectIdField))
-        presetLinks.push([vars.get(pObjectIdField), vars.get(pRowIdField)]);
-
-    if (vars.exists(pParentContextField) && vars.exists(pParentIdField))
-    {
-        switch (vars.get(pParentContextField))
-        {
-            case "Activity":
-                presetLinks = presetLinks.concat(db.table(SqlCondition.begin()
-                             .andPrepare("ACTIVITYLINK.ACTIVITY_ID", vars.get(pParentIdField))
-                             .buildSql("select OBJECT_TYPE, OBJECT_ROWID from ACTIVITYLINK", "1=2")));
-                break;
-            case "Task":
-                presetLinks = presetLinks.concat(db.table(SqlCondition.begin()
-                             .andPrepare("TASKLINK.TASK_ID", vars.get(pParentIdField))
-                             .buildSql("select OBJECT_TYPE, OBJECT_ROWID from TASKLINK", "1=2")));
-                break;
-            case "SupportTicket":
-                presetLinks = presetLinks.concat(db.table(SqlCondition.begin()
-                             .andPrepare("TICKET.TICKETID", vars.get(pParentIdField))
-                             .buildSql("select OBJECT_TYPE, OBJECT_ROWID from TICKET join TASKLINK on TASKLINK.TASK_ID = TICKET.TASK_ID", "1=2")));
-                break;
-        }
-        
-    }
-
-    presetLinks.forEach(function(link) {
-        neon.addRecord(pConsumerName, {
-            "OBJECT_TYPE" : link[0], 
-            "OBJECT_ROWID" : link[1]
-        });
-    });
-}
-
+import("system.logging");
+import("Binary_lib");
+import("system.vars");
+import("system.util");
+import("system.datetime");
+import("system.text");
+import("system.neon");
+import("system.db");
+import("system.translate");
+import("system.eMath");
+import("Util_lib");
+import("Sql_lib");
+import("Keyword_lib");
+import("KeywordRegistry_basic");
+import("Product_lib");
+import("Report_lib");
+import("Context_lib");
+
+/**
+ * Methods used by for activities (former history).
+ * Do not create an instance of this!
+ * 
+ * @class
+ */
+function ActivityUtils() {}
+
+/**
+ * Create a new activity within the database-scope.
+ * This funciton will insert a complete new activity into the Database
+ * 
+ * @param {Object} [pDataPreset={}] an object that contains the data for the activity, you do not need to specify any preset data at all,
+ *                                  but you CAN define the following properties: 
+ *                                  <ul>
+ *                                  <li>activityId</li>
+ *                                  <li>responsibleContactId</li>
+ *                                  <li>categoryKeywordId</li>
+ *                                  <li>directionKeywordId</li>
+ *                                  <li>subject</li>
+ *                                  <li>content</li>
+ *                                  </ul>
+ * @param {Array} [pActivityLinks] 2D array where each element is an array of Contextname and objectid, for example:
+ *                                 <pre>[["Organisation", "2d1e505c-a75a-4fa6-826b-7224a97d5b51"]]</pre>
+  * @param {Array} [pDocuments] 2D array where each element is an array of:
+   *                                <ul>
+ *                                  <li>document-name</li>
+ *                                  <li>document-content(base64-string)</li>
+ *                                  <li>true/false if it's mainDocument or not</li>
+ *                                  </ul>
+ *                                  for example:
+ *                                  <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre>
+ * @param {String} [pDbAlias=current db alias] database alias where the activity shall be inserted
+ * 
+ * @return {Object} js object where the following are filled:
+ *                                  <ul>
+ *                                  <li>activityId</li>
+ *                                  </ul>
+ */
+ActivityUtils.insertNewActivity = function(pDataPreset, pActivityLinks, pDocuments, pDbAlias)
+{
+    var dataPreset = pDataPreset || {};
+    var dbAlias = pDbAlias || db.getCurrentAlias();
+    var insertStatements = [];
+    
+    var creationUser = vars.get("$sys.user");
+    var creationDate = datetime.date();
+    
+    var activityId = dataPreset.activityId || util.getNewUUID();
+    var entrydate = pDataPreset.entrydate || creationDate;
+
+    var activityColumns = ["ACTIVITYID", "DATE_NEW", "USER_NEW", "ENTRYDATE"];
+    var activityValues = [activityId, creationDate, creationUser, entrydate];
+    
+    _addActivityCol("CATEGORY", dataPreset.categoryKeywordId);
+    _addActivityCol("DIRECTION", dataPreset.directionKeywordId);
+    _addActivityCol("INFO", dataPreset.content);
+    _addActivityCol("RESPONSIBLE", dataPreset.responsibleContactId);
+    _addActivityCol("SUBJECT", dataPreset.subject);
+    
+    insertStatements.push(["ACTIVITY", activityColumns, db.getColumnTypes("ACTIVITY", activityColumns, dbAlias), activityValues]);
+
+    if (pActivityLinks)
+    {
+        var activityLinkColumns = ["ACTIVITYLINKID", "ACTIVITY_ID", "DATE_NEW", "USER_NEW", "OBJECT_TYPE", "OBJECT_ROWID"];
+        var activityLinkColumnTypes = db.getColumnTypes("ACTIVITYLINK", activityLinkColumns, dbAlias);
+        var activityLinkValues;
+        for (var i = 0, l = pActivityLinks.length; i < l; i++)
+        {
+            activityLinkValues = [util.getNewUUID(), activityId, creationDate, creationUser, pActivityLinks[i][0], pActivityLinks[i][1]];
+            insertStatements.push(["ACTIVITYLINK", activityLinkColumns, activityLinkColumnTypes, activityLinkValues]);
+        }
+    }
+    
+    db.inserts(insertStatements, dbAlias);
+    
+    if (pDocuments)
+        ActivityUtils.insertDocuments(activityId, pDocuments);
+
+    return {
+        activityId: activityId
+    };
+
+    function _addActivityCol(pColumn, pValue, pDefaultValue)
+    {
+        if (pValue || pDefaultValue)
+        {
+            activityColumns.push(pColumn);
+            activityValues.push(pValue || pDefaultValue);
+        }
+    }
+};
+
+/**
+ * inserts documents for an activity
+ * 
+ * @param {String} pActivityId activity id
+ * @param {Array} pDocuments 2D array where each element is an array of:
+ *                                  <ul>
+ *                                  <li>document-name</li>
+ *                                  <li>document-content(base64-string)</li>
+ *                                  <li>true/false if it's mainDocument or not</li>
+ *                                  </ul>
+ *                                  for example:
+ *                                  <pre>[["number.txt", "MDExOCA5OTkgODgxIDk5OSAxMTkgNzI1IDM", true]]</pre>
+ */
+ActivityUtils.insertDocuments = function (pActivityId, pDocuments)
+{
+    pDocuments.forEach(function (document)
+    {
+        var filename, b64Content, isMainDocument;
+        [filename, b64Content, isMainDocument] = document;
+        if (isMainDocument)
+            SingleBinaryUtils.insertMainDocument("ACTIVITY", "DOCUMENT", pActivityId, b64Content, filename);
+        else
+            SingleBinaryUtils.insert("ACTIVITY", "DOCUMENT", pActivityId, b64Content, filename);
+    });
+}
+
+/**
+ * Create a new activity
+ */
+ActivityUtils.createNewActivity = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pSubject, pInfo, pDirection, pDocuments)
+{
+    var params = {};
+    if (pDocuments)
+        params["PresetDocuments_param"] = JSON.stringify(pDocuments);
+    if (pSubject)
+        params["Subject_param"] = pSubject;
+    if (pInfo)
+        params["Info_param"] = text.text2html(pInfo.trim(), false);
+    if (pDirection)
+        params["Direction_param"] = pDirection;
+    
+    _ActivityTaskUtils._createNew("Activity", pRowId, pAdditionalLinks, pParentContext, pParentId, params)
+}
+
+/*
+ * Gets the date of the last activity
+ * 
+ * @param {String} pRowId the rowid of the dataset
+ * 
+ * @return {number|null} the date of the last actvity as long
+ */
+ActivityUtils.getLastActivityDate = function(pRowId)
+{
+    var context = ContextUtils.getCurrentContextId();
+    var sqlUtil = new SqlMaskingUtils();
+    var activitySql = "select " + sqlUtil.max("ENTRYDATE") + " from ACTIVITY "
+        + " join ACTIVITYLINK on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID";
+    activitySql = SqlCondition.begin()
+        .andPrepare("ACTIVITYLINK.OBJECT_TYPE", context)
+        .andPrepare("ACTIVITYLINK.OBJECT_ROWID", pRowId)
+        .buildSql(activitySql);
+    
+    var entryDate = db.cell(activitySql);
+    if (entryDate != "")
+        return parseInt(entryDate);
+    return null;
+}
+
+/**
+ * add the links to the link-table in new mode
+ * 
+ * @return {String} pObjectIdField jdito Field for the objectId
+ * @return {String} pRowIdField jdito Field for the rowId
+ * @return {String} pAdditionalLinksField jdito Field for additional links
+ */
+ActivityUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField)
+{
+    _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links");
+}
+
+ActivityUtils.hasActivities = function (pRowId, pObjectType)
+{
+    if (pRowId && pObjectType)
+    {
+        var cond = SqlCondition.begin().andPrepare("ACTIVITYLINK.OBJECT_TYPE", pObjectType)
+                                       .andPrepare("ACTIVITYLINK.OBJECT_ROWID", pRowId);
+        var taskCount = db.cell(cond.buildSql("select count(*) from ACTIVITYLINK"));
+        if (taskCount != "0")
+            return true;
+        return false;
+    }
+    return true;
+}
+
+/**
+ * Methods used by for tasks.
+ * Do not create an instance of this!
+ * 
+ * @class
+ */
+function TaskUtils () {}
+   
+
+/**
+ * Create a new task
+ */
+TaskUtils.createNewTask = function(pRowId, pAdditionalLinks, pParentContext, pParentId, pParams, pDocuments)
+{
+    _ActivityTaskUtils._createNew("Task", pRowId, pAdditionalLinks, pParentContext, pParentId, pParams, pDocuments)
+}
+
+/**
+ * Create a new task
+ */
+TaskUtils.hasTasks = function(pRowId, pObjectType)
+{
+    if (pRowId != "" && pObjectType != "")
+    {
+        var cond = SqlCondition.begin().andPrepare("TASKLINK.OBJECT_TYPE", pObjectType)
+                                       .andPrepare("TASKLINK.OBJECT_ROWID", pRowId);
+        var taskCount = db.cell(cond.buildSql("select count(*) from TASKLINK"));
+        if (taskCount != "0")
+            return true;
+        else 
+            return false;
+    }
+    else
+        return true;
+}
+
+TaskUtils.getStatusIcon = function(pStatus)
+{
+    return KeywordUtils.getAttributeRelation(pStatus, $KeywordRegistry.taskStatus(), "icon", "NEON:STATUS_NOT_STARTED");
+}
+
+/**
+ * add the links to the link-table in new mode
+ * 
+ * @return {String} pObjectIdField jdito Field for the objectId
+ * @return {String} pRowIdField jdito Field for the rowId
+ * @return {String} pAdditionalLinksField jdito Field for additional links
+ */
+TaskUtils.addLinkRecords= function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField)
+{
+    _ActivityTaskUtils._addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links");
+}
+
+/**
+ * Methods used by for tasks.
+ * Do not create an instance of this!
+ * 
+ * @ignore
+ * @class
+ */
+function _ActivityTaskUtils() {}
+   
+
+/**
+ * Create a new task
+ * @ignore
+ */
+_ActivityTaskUtils._createNew = function(pContext, pRowId, pAdditionalLinks, pParentContext, pParentId, pParams)
+{
+    if (pAdditionalLinks == undefined)
+        pAdditionalLinks = [];
+       
+    var params = {};
+    
+    if (pParams)
+        params = pParams
+     
+    if (pRowId)
+    {
+        params["ObjectId_param"] = ContextUtils.getCurrentContextId();
+        params["RowId_param"] = pRowId;
+    }
+        
+    params["PresetLinks_param"] = JSON.stringify(pAdditionalLinks);
+    
+    if (pParentContext && pParentId)
+    {
+        
+        
+        params["ParentContext_param"] = pParentContext;
+        params["ParentId_param"] = pParentId;
+    }
+    
+    neon.openContext(pContext, null, null, neon.OPERATINGSTATE_NEW, params);
+}
+
+/**
+ * add the links to the link-table in new mode
+ * 
+ * @return {String} pObjectIdField jdito Field for the objectId
+ * @return {String} pRowIdField jdito Field for the rowId
+ * @return {String} pAdditionalLinksField jdito Field for additional links
+ * 
+ * @ignore
+ */
+_ActivityTaskUtils._addLinkRecords = function(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, pConsumerName)
+{
+    if (vars.exists(pAdditionalLinksField))
+        presetLinks = JSON.parse(vars.getString(pAdditionalLinksField));
+
+    if (!presetLinks)
+        presetLinks = [];
+    
+    if (vars.exists(pRowIdField) && vars.get(pRowIdField)
+        && vars.exists(pObjectIdField) && vars.get(pObjectIdField))
+        presetLinks.push([vars.get(pObjectIdField), vars.get(pRowIdField)]);
+
+    if (vars.exists(pParentContextField) && vars.exists(pParentIdField))
+    {
+        switch (vars.get(pParentContextField))
+        {
+            case "Activity":
+                presetLinks = presetLinks.concat(db.table(SqlCondition.begin()
+                             .andPrepare("ACTIVITYLINK.ACTIVITY_ID", vars.get(pParentIdField))
+                             .buildSql("select OBJECT_TYPE, OBJECT_ROWID from ACTIVITYLINK", "1=2")));
+                break;
+            case "Task":
+                presetLinks = presetLinks.concat(db.table(SqlCondition.begin()
+                             .andPrepare("TASKLINK.TASK_ID", vars.get(pParentIdField))
+                             .buildSql("select OBJECT_TYPE, OBJECT_ROWID from TASKLINK", "1=2")));
+                break;
+            case "SupportTicket":
+                presetLinks = presetLinks.concat(db.table(SqlCondition.begin()
+                             .andPrepare("TICKET.TICKETID", vars.get(pParentIdField))
+                             .buildSql("select OBJECT_TYPE, OBJECT_ROWID from TICKET join TASKLINK on TASKLINK.TASK_ID = TICKET.TASK_ID", "1=2")));
+                break;
+        }
+        
+    }
+
+    presetLinks.forEach(function(link) {
+        neon.addRecord(pConsumerName, {
+            "OBJECT_TYPE" : link[0], 
+            "OBJECT_ROWID" : link[1]
+        });
+    });
+}
+