diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod
index 99df1396f1fb18107f11dd2d9258d405aa317841..2aeb6248fe3181dc928ed5a5ec054298a8e388f0 100644
--- a/entity/CampaignStep_entity/CampaignStep_entity.aod
+++ b/entity/CampaignStep_entity/CampaignStep_entity.aod
@@ -338,9 +338,12 @@
         <entityParameter>
           <name>campaignId_param</name>
           <valueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/campaignid_param/valueProcess.js</valueProcess>
-          <expose v="true" />
           <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>
@@ -379,6 +382,10 @@
       <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>
diff --git a/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js b/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js
new file mode 100644
index 0000000000000000000000000000000000000000..00062fc76127c61b752533c1c15f0578b8e65ce0
--- /dev/null
+++ b/entity/CampaignStep_entity/entityfields/campaignstepsconsumer/children/maxsort_param/valueProcess.js
@@ -0,0 +1,4 @@
+import("system.vars");
+import("system.result");
+
+result.string(parseInt(vars.get("$field.SORTING")) - 1);
\ No newline at end of file
diff --git a/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js b/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js
index c693832d8e3fad0d122698e5320c4248edf4735f..1049e6cdec0f35e2915051b645b193f32ae8cd51 100644
--- a/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js
+++ b/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js
@@ -1,7 +1,12 @@
+import("system.db");
+import("Sql_lib");
 import("system.vars");
 import("system.result");
 
-if(vars.exists("$param.campaignId_param") && vars.get("$param.campaignId_param"))
-{
-    result.string("CAMPAIGN_ID = '" + vars.getString("$param.campaignId_param") + "'");
-}
+var cond = SqlCondition.begin()
+                       .andPrepareVars("CAMPAIGNSTEP.CAMPAIGN_ID", "$param.campaignId_param");
+
+cond.andPrepareIfSet("CAMPAIGNSTEP.SORTING", vars.getString("$param.maxSort_param"), "# <= ?");
+
+
+result.string(db.translateCondition(cond.build("1=1")));
\ No newline at end of file
diff --git a/entity/Campaign_entity/recordcontainers/db/onDBInsert.js b/entity/Campaign_entity/recordcontainers/db/onDBInsert.js
index 3e50c24a9be0f2bbcdec05b44d1c9218de48279d..6d2693518fe2c61ae294a2100a7e20794f9e129b 100644
--- a/entity/Campaign_entity/recordcontainers/db/onDBInsert.js
+++ b/entity/Campaign_entity/recordcontainers/db/onDBInsert.js
@@ -1,3 +1,4 @@
+import("system.neon");
 import("Employee_lib");
 import("system.translate");
 import("KeywordRegistry_basic");
@@ -7,16 +8,17 @@ import("system.db");
 import("system.datetime");
 import("Campaign_lib");
 
-if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.originalCampaignIdCopy_param"))
-    CampaignUtils.copyCampaignSteps(vars.getString("$param.originalCampaignIdCopy_param"), vars.get("$field.CAMPAIGNID"));
+var rowdata = vars.get("$local.rowdata");
+var campaignId = vars.get("$local.uid");
+
+if (vars.get("$param.originalCampaignIdCopy_param"))
+    CampaignUtils.copyCampaignSteps(vars.getString("$param.originalCampaignIdCopy_param"), campaignId);
 else
 {
-    var rowdata = vars.get("$local.rowdata");
-
     var threeWeeks = datetime.ONE_WEEK * 3;
     var inThreeWeeks = datetime.date() + threeWeeks;
 
-    var campaignId = vars.get("$local.uid");
+    
     var campaignStepId = util.getNewUUID();
     var campaignStepName = translate.text("Added");
 
diff --git a/process/Campaign_lib/process.js b/process/Campaign_lib/process.js
index f9e374f70b976108bea351a632785e0a891920b1..4557361ebd07d298834c1708421918a2dbd5b97d 100644
--- a/process/Campaign_lib/process.js
+++ b/process/Campaign_lib/process.js
@@ -420,14 +420,16 @@ CampaignUtils.copyCampaign = function(pCampaignid, pDescription, pEmplContactId,
 /**
  * copies all campaign steps from one campaign to another
  * 
- * @param {String} pSourceOfferId
- * @param {String} pTargetOfferId
+ * @param {String} pSourceCampaignId
+ * @param {String} pTargetCampaignId
  */
 CampaignUtils.copyCampaignSteps = function(pSourceCampaignId, pTargetCampaignId)
 {
         var InputMapping = {
         "CAMPAIGNSTEP": {
-            condition: "CAMPAIGN_ID = '" + pSourceCampaignId + "' order by SORTING",
+            condition: db.translateCondition(SqlCondition().begin()
+                            .andPrepare("CAMPAIGN.CAMPAIGN_ID", pSourceCampaignId)
+                            .buildSql("", "1=2", "order by SORTING", false)),
             ValueMapping: {
                 "CAMPAIGN_ID" : pTargetCampaignId
             }
diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js
index 96fad8157daf52446aaf45d30932f3e1e99568d7..e94147d3228b7a16f7cbc3554dabcdcf6e00134f 100644
--- a/process/Sql_lib/process.js
+++ b/process/Sql_lib/process.js
@@ -393,7 +393,7 @@ SqlCondition.prototype.orIn = function(field, values, fieldType, not) {
  * @return {SqlCondition} current SqlCondition-object
  */
 SqlCondition.prototype._in = function(field, values, fieldType, not) {
-    if (values.length > 0)
+    if (values && values.length > 0)
     {
         if (fieldType == undefined)
             fieldType = SqlUtils.getSingleColumnType(field, undefined, this.alias);