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

Task query parameters withoutCandidateGroups and withoutCandidateUsers cannot be used in combination if both are true

    XMLWordPrintable

Details

    Description

      Environment:

      Camunda docker image: camunda/camunda-bpm-platform:7.14.0

      Description:

      The main goal is to retrieve a list of all (unassigned) tasks from the task REST API which does not contain any candidates (CandidateUsers and CandidateGroups).

      However the parameter "withoutCandidateGroups": true in combination with "withoutCandidateUsers": true does not work as expected.
      Instead the candidate filters are ignored and the result is only filtered by unassigned: true (which is the default case when dealing with candidates).

      The current workaround is to make two separate calls to the TASK API, one for withoutCandidateUsers: true, one for withoutCandidateGroups: true and find the intersection of both result sets.

      Steps to reproduce:

      • Precondition: Multiple tasks with different assignee/candidate combination exist
      • Query tasks from the tasks REST API (POST /task) with the following parameters:
      {
          "withoutCandidateGroups": true,
          "withoutCandidateUsers": true
      }
      

      Observed behavior:

      If both parameters are set:
      "withoutCandidateGroups": true
      "withoutCandidateUsers": true

      neither of them are respected.

      Expected behavior:

      If both parameters withoutCandidateUsers and withoutCandidateGroups are set true, the Task API should
      only return unassigned tasks without CandidateUsers and CandidateGroups.

      Root Cause:

      Current implementation in Task.xml does not respect the case if both parameters are true:

          <if test="query.withoutCandidateGroups || query.withoutCandidateUsers">
            ${queryType}
            <trim prefixOverrides="and" prefix="(" suffix=")">
              <if test="!query.includeAssignedTasks">
                and RES.ASSIGNEE_ is null
              </if>
              and NOT EXISTS (
                select 1
                from ${prefix}ACT_RU_IDENTITYLINK I
                <where>
                  I.TYPE_ = 'candidate'
                  <if test="query.withoutCandidateGroups">
                    and I.GROUP_ID_ is not null
                  </if>
                  <if test="query.withoutCandidateUsers">
                    and I.USER_ID_ is not null
                  </if>
                  AND I.TASK_ID_ = RES.ID_
                </where>
              )
            </trim>
          </if>
      

      The table ACT_RU_IDENTITYLINK only contains entries having either one column CandidateUsers or CandidateGroups set, but never both.
      Querying for NOT NULL in both columns will always result in an empty result set here.
      Hence, "WHERE NOT EXISTS" always returns all Tasks from ACT_RU_TASK.

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              tassilo.weidner Tassilo Weidner
              cheizmann Chris Heizmann
              Tassilo Weidner Tassilo Weidner
              Miklas Boskamp Miklas Boskamp
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce