diff --git a/src/app/resource/controllers/ResController.php b/src/app/resource/controllers/ResController.php
index d01b279cc4d78860c7f66441601e18c5b04183d5..a9be47310a21f8dacc7b3f78aa8e47b078fb7fa4 100755
--- a/src/app/resource/controllers/ResController.php
+++ b/src/app/resource/controllers/ResController.php
@@ -781,7 +781,7 @@ class ResController
 
             if (!empty($body['initiator'])) {
                 $userEntities = UserModel::getEntitiesByLogin(['login' => $GLOBALS['userId']]);
-                $userEntities = array_column($userEntities, 'entity_id');
+                $userEntities = array_column($userEntities, 'id');
                 if (!in_array($body['initiator'], $userEntities)) {
                     return ['errors' => "Body initiator does not belong to your entities"];
                 }
@@ -1011,16 +1011,15 @@ class ResController
                 $allowedEntities = array_unique($allowedEntities);
             }
 
-            $preparedClause = '';
             if (!empty($clauseToProcess)) {
                 $preparedClause = PreparedClauseController::getPreparedClause(['clause' => $clauseToProcess, 'login' => $GLOBALS['userId']]);
-            }
-            if (!empty($allowedEntities)) {
-                $preparedEntities = EntityModel::get(['select' => ['entity_id'], 'where' => ['enabled = ?', 'id in (?)'], 'data' => ['Y', $allowedEntities]]);
-                $allowedEntities = array_column($preparedEntities, 'entity_id');
+                $preparedEntities = EntityModel::get(['select' => ['id'], 'where' => ['enabled = ?', "entity_id in {$preparedClause}"], 'data' => ['Y']]);
+                $preparedEntities = array_column($preparedEntities, 'id');
+                $allowedEntities = array_merge($allowedEntities, $preparedEntities);
+                $allowedEntities = array_unique($allowedEntities);
             }
 
-            if (!in_array($body['destination'], $allowedEntities) && strpos($preparedClause, $body['destination']) === false) {
+            if (!in_array($body['destination'], $allowedEntities)) {
                 return ['errors' => "Body destination is out of your indexing parameters"];
             }
         }
diff --git a/src/app/resource/controllers/StoreController.php b/src/app/resource/controllers/StoreController.php
index c1e34f5ac3a4d7265ae2cc99107317fdbfe3ee03..a95aa3c6b4ae596c8da57600751663627511a697 100755
--- a/src/app/resource/controllers/StoreController.php
+++ b/src/app/resource/controllers/StoreController.php
@@ -17,6 +17,7 @@ namespace Resource\controllers;
 
 use Attachment\models\AttachmentModel;
 use Docserver\controllers\DocserverController;
+use Entity\models\EntityModel;
 use IndexingModel\models\IndexingModelModel;
 use Resource\models\ChronoModel;
 use SrcCore\models\DatabaseModel;
@@ -125,6 +126,15 @@ class StoreController
             $chrono = ChronoModel::getChrono(['id' => $indexingModel['category'], 'entityId' => $args['destination'], 'typeId' => $args['doctype'], 'resId' => $args['resId']]);
         }
 
+        if (!empty($args['initiator'])) {
+            $entity = EntityModel::getById(['id' => $args['initiator'], 'select' => ['entity_id']]);
+            $args['initiator'] = $entity['entity_id'];
+        }
+        if (!empty($args['destination'])) {
+            $entity = EntityModel::getById(['id' => $args['destination'], 'select' => ['entity_id']]);
+            $args['destination'] = $entity['entity_id'];
+        }
+
         if (!empty($args['processLimitDate']) && !empty($args['priority'])) {
             $args['priority'] = IndexingController::calculatePriorityWithProcessLimitDate(['processLimitDate' => $args['processLimitDate']]);
         }