diff --git a/entity/EmployeeRole_entity/recordcontainers/jdito/contentProcess.js b/entity/EmployeeRole_entity/recordcontainers/jdito/contentProcess.js
index dd75cc33f86c2b062631ed65b17a701a7ae79d31..84cbd8aec77c4f592a21d310a3fe304e041e3f96 100644
--- a/entity/EmployeeRole_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/EmployeeRole_entity/recordcontainers/jdito/contentProcess.js
@@ -31,7 +31,18 @@ if (userTitle && tools.existUsers(userTitle))
 }
 
 var idvalues = vars.get("$local.idvalues");
-if (!Utils.isNullOrEmpty(idvalues))
+var selectedRole = vars.get("$field.ROLE");
+
+// if idvalues and selectedRole are filled -> insert, update or delete happened
+// if idvalues and selectedRole are filled and distinct -> edit (role in idvalues got changed to role in selectedRole)
+if (!Utils.isNullOrEmpty(idvalues) && !Utils.isNullOrEmpty(selectedRole) && idvalues != selectedRole)
+{
+    roles = roles.filter(function(role) 
+    {
+        return selectedRole.includes(role[0]);
+    });
+} 
+else if (!Utils.isNullOrEmpty(idvalues))
 {
     roles = roles.filter(function(role) 
     {