Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-4441

API: Task - Get Tasks: involvedUser not working properly

      From the documentation: "Only include tasks that the given user is involved in. A user is involved in a task if an identity link exists between task and user (e.g. the user is the assignee)."
      If user is only assignee or owner (or both) of a task, API search does not return this task with parameter involvedUser, although the identity link exists. If I add another identity link of different type than owner or assignee, then the task is returned.

      AT:

      • When involvedUser is used, filter the query also by task assignee and owner
      • Create indexes on those columns
      • Validate that it is already correct in the history query (in this case we persist identity links for assignees and owners)

        This is the controller panel for Smart Panels app

            [CAM-4441] API: Task - Get Tasks: involvedUser not working properly

            Thanks for reporting.

            Can you provide a failing testcase on this and/or the query you are executing?

            Cheers
            Robert

            Robert Gimbel added a comment - Thanks for reporting. Can you provide a failing testcase on this and/or the query you are executing? Cheers Robert

            Hello.

            I call "http://localhost:8081/engine-rest/task/?assignee=admin"
            and I get
            [{
            "id": "02825139-e489-4a98-bb78-51886fe9000c",
            "name": "test 2",
            "assignee": "admin",
            ......
            "owner": "admin",
            ......
            }]

            Then I call "http://localhost:8081/engine-rest/task/02825139-e489-4a98-bb78-51886fe9000c/identity-links"
            and I get
            [{
            "userId": "admin",
            "groupId": null,
            "type": "assignee"
            }, {
            "userId": "admin",
            "groupId": null,
            "type": "owner"
            }]

            So, you see, that Identity links for this task exist.
            That means, when I call "http://localhost:8081/engine-rest/task/?involvedUser=admin" , it should return me the same task list as with the first call, but I get only an empty array:
            [ ]

            Tomas Troksiar added a comment - Hello. I call "http://localhost:8081/engine-rest/task/?assignee=admin" and I get [{ "id": "02825139-e489-4a98-bb78-51886fe9000c", "name": "test 2", "assignee": "admin", ...... "owner": "admin", ...... }] Then I call "http://localhost:8081/engine-rest/task/02825139-e489-4a98-bb78-51886fe9000c/identity-links" and I get [{ "userId": "admin", "groupId": null, "type": "assignee" }, { "userId": "admin", "groupId": null, "type": "owner" }] So, you see, that Identity links for this task exist. That means, when I call "http://localhost:8081/engine-rest/task/?involvedUser=admin" , it should return me the same task list as with the first call, but I get only an empty array: [ ]

            Hi Tomas,

            I can confirm that this is a bug.

            Cheers,
            Roman

            Roman Smirnov added a comment - Hi Tomas, I can confirm that this is a bug. Cheers, Roman

            Hi Tomas,

            if this issue is very urgent from your side, you can speed things up by submitting a pull request, that solves this issue.

            Cheers
            Robert

            Robert Gimbel added a comment - Hi Tomas, if this issue is very urgent from your side, you can speed things up by submitting a pull request, that solves this issue. Cheers Robert

            Hi,

            in version 7.9 this bug still exists. The problem is the following code:
            Class: org.camunda.bpm.engine.impl.cmd.AddIdentityLinkCmd (line 71)

            public Void execute(CommandContext commandContext) {
            
                ensureNotNull("taskId", taskId);
            
                TaskManager taskManager = commandContext.getTaskManager();
                task = taskManager.findTaskById(taskId);
                EnsureUtil.ensureNotNull("Cannot find task with id " + taskId, "task", task);
            
                checkAddIdentityLink(task, commandContext);
                
                if (IdentityLinkType.ASSIGNEE.equals(type)) {
                  task.setAssignee(userId);
                } else if (IdentityLinkType.OWNER.equals(type)) {
                  task.setOwner(userId);
                } else {
                  task.addIdentityLink(userId, groupId, type);
                }
            
                return null;
              }
            

            When you set an assignee to the task it will never create an identity link. And the involved user query is querying the identity links and ignores the assignee value

            Please solve this problem in one of the next releases.

            Cheers,
            Christian

            Christian Werz added a comment - Hi, in version 7.9 this bug still exists. The problem is the following code: Class: org.camunda.bpm.engine.impl.cmd.AddIdentityLinkCmd (line 71) public Void execute(CommandContext commandContext) { ensureNotNull( "taskId" , taskId); TaskManager taskManager = commandContext.getTaskManager(); task = taskManager.findTaskById(taskId); EnsureUtil.ensureNotNull( "Cannot find task with id " + taskId, "task" , task); checkAddIdentityLink(task, commandContext); if (IdentityLinkType.ASSIGNEE.equals(type)) { task.setAssignee(userId); } else if (IdentityLinkType.OWNER.equals(type)) { task.setOwner(userId); } else { task.addIdentityLink(userId, groupId, type); } return null ; } When you set an assignee to the task it will never create an identity link. And the involved user query is querying the identity links and ignores the assignee value Please solve this problem in one of the next releases. Cheers, Christian

            Juan Parra added a comment - - edited

            It is not a bug, it is only a misunderstanding on documentation, by default includeAssignedTasks is established on false, so involvedUser or candidateXX, is not going to work as both of you expected, just add includeAssignedTasks=true to query string.

            http://localhost:8081/engine-rest/task/?involvedUser=admin&includeAssignedTasks=true
            

            Juan Parra added a comment - - edited It is not a bug, it is only a misunderstanding on documentation, by default includeAssignedTasks is established on false, so involvedUser or candidateXX, is not going to work as both of you expected, just add includeAssignedTasks=true to query string. http: //localhost:8081/engine- rest /task/?involvedUser=admin&includeAssignedTasks= true

            Henrique added a comment -

            Hi.
            I have the same problem here.
            The "involvedUser" not working properly (I get only an empty array "[]", when I use: /task/?involvedUser=admin)

            When I try the @Juan Parra solution (includeAssignedTasks=true), I have this error:

            {
                "type": "ProcessEngineException",
                "message": "Invalid query usage: candidateUser, candidateGroup, candidateGroupIn, withCandidateGroups, withoutCandidateGroups, withCandidateUsers, withoutCandidateUsers has to be called before 'includeAssignedTasks'."
            }
            

             

            Can you help us?

             

            Henrique added a comment - Hi. I have the same problem here. The "involvedUser" not working properly (I get only an empty array "[]", when I use: /task/?involvedUser=admin) When I try the @Juan Parra solution (includeAssignedTasks=true), I have this error: { "type" : "ProcessEngineException" , "message" : "Invalid query usage: candidateUser, candidateGroup, candidateGroupIn, withCandidateGroups, withoutCandidateGroups, withCandidateUsers, withoutCandidateUsers has to be called before 'includeAssignedTasks' ." }   Can you help us?  

              thorben.lindhauer Thorben Lindhauer
              troky Tomas Troksiar
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: