cancel
Showing results for 
Search instead for 
Did you mean: 

Task not assigned to group (activiti:candidateGroups)

nicolasraoul
Star Contributor
Star Contributor
The pooled review workflow works fine as long as the first userTask has activiti:candidateGroups="${bpm_groupAssignee.properties.authorityName}".

But if I replace with activiti:candidateGroups="PURCHASING_AGENTS" then nobody seems to receive the task.

I made sure I have a group called PURCHASING_AGENTS which contains my user (admin).
There are no visible errors in the log nor UI.
When going to "My Tasks", both "Tasks Assigned to Me" and "Unassigned Tasks (Pooled)" are empty.
The workflow is visible in the Workflow Console.

Any idea why I don't receive the task?
Is my syntax wrong?

The workflow (very similar to pooled review):
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20">
  <process id="process2" name="Process 2 (derived from pooled review)">
    <startEvent id="start" activiti:formKey="nicowf:purchase"></startEvent>
    <userTask id="reviewTask" name="Review Task" activiti:candidateGroups="PURCHASING_AGENTS" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>
              if (typeof bpm_workflowDueDate != 'undefined') task.setVariable('bpm_dueDate', bpm_workflowDueDate);
              if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
            </activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>
    <userTask id="approved" name="Document Approved" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:approvedTask">
      <documentation>
                The document was reviewed and approved.
            </documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('bpm_assignee', person);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <userTask id="rejected" name="Document Rejected" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:rejectedTask">
      <documentation>
                The document was reviewed and rejected.
            </documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('bpm_assignee', person);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <endEvent id="end"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="start" targetRef="reviewTask"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="reviewTask" targetRef="reviewDecision"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="reviewDecision" targetRef="approved">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="reviewDecision" targetRef="rejected"></sequenceFlow>
    <sequenceFlow id="flow5" name="" sourceRef="approved" targetRef="end"></sequenceFlow>
    <sequenceFlow id="flow6" name="" sourceRef="rejected" targetRef="end"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_process2">
    <bpmndi:BPMNPlane bpmnElement="process2" id="BPMNPlane_process2">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">
        <omgdc:Bounds height="55" width="105" x="105" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
        <omgdc:Bounds height="40" width="40" x="250" y="197"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="approved" id="BPMNShape_approved">
        <omgdc:Bounds height="55" width="105" x="330" y="137"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="rejected" id="BPMNShape_rejected">
        <omgdc:Bounds height="55" width="105" x="330" y="257"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="35" width="35" x="620" y="147"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="105" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="210" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="250" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="270" y="197"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="164"></omgdi:waypoint>
        <omgdi:waypoint x="330" y="164"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="270" y="237"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="284"></omgdi:waypoint>
        <omgdi:waypoint x="330" y="284"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="435" y="164"></omgdi:waypoint>
        <omgdi:waypoint x="620" y="164"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="435" y="284"></omgdi:waypoint>
        <omgdi:waypoint x="637" y="284"></omgdi:waypoint>
        <omgdi:waypoint x="637" y="182"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Thanks a lot!
Nicolas Raoul
11 REPLIES 11

afaust
Legendary Innovator
Legendary Innovator
Hello,

it seems you're forgetting the prefix "GROUP_" which is part of the authority name and should be provided.

Regards
Axel

Hi Axel,
Where should the "GROUP_" be prefixed? I'm facing this same trouble and after reading this post, I have something like this:
candidateGroups="GROUPS_PURCHASING_AGENTS"
(borrowing from Nicolas's example) yet it didn't show up.

What am I doing wrong? Where should I append the "GROUP_"?

nicolasraoul
Star Contributor
Star Contributor
Thanks, that worked!
Nicolas

mitpatoliya
Star Collaborator
Star Collaborator
Yes that is the location it should be placed
activiti:candidateGroups="GROUP_PURCHASING_AGENTS"
are you getting any error in the logs?
Also I hope you are not missing "activiti" prefix before candidateGroups

Thanks for the reply.

I put it there, exactly, yet I don't see the progression. The start-task form is visible and when I start it up, I notice that it is running at the workflow console, but it's not available for the users on that group to claim it.

No error is shown at the log as regards to it. The log is clean. A segment of my bpmn is shown below:


<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn"
   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
   xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema"
   expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://celestocalcul.us/bpmn">
   <process id="assuranceReq" name="Assurance Requisition Process"
      isExecutable="true">
      <startEvent id="alfrescoStartevent1" name="Alfresco start"
         activiti:formKey="wf:submitGroupReviewTask"></startEvent>
<sequenceFlow id="flow1" sourceRef="alfrescoStartevent1"
         targetRef="userTask_InitProcess">
         <extensionElements>
            <activiti:executionListener event="start"
               class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
               <activiti:field name="script">
                  <activiti:string>var started = true; var memoReviewed = false; var
                     memoRejectionCount = 0;</activiti:string>
               </activiti:field>
            </activiti:executionListener>
         </extensionElements>
      </sequenceFlow>
      <userTask id="userTask_InitProcess" name="IT Manager sends memo to MD"
         activiti:candidateGroups="GROUP_IT_MGR" activiti:formKey="wf:activitiReviewTask"></userTask>
<sequenceFlow id="flow2" sourceRef="userTask_InitProcess"
         targetRef="userTask_MDReviewsMemo"></sequenceFlow>
      <userTask id="userTask_MDReviewsMemo" name="MD reviews memo"
         activiti:candidateGroups="GROUP_MG_DIR" activiti:formKey="wf:activitiReviewTask"></userTask>


The startEvent works perfectly, but the workflow is not available to users of the group to claim it. As you would observe, I didn't use any custom model for any of them, so I I didn't need to define anything else.

Hi Mits

sorry to boder you for a sec please. I have seen your post regarding how to make sure we are assigning a task to an Alfresco Group, and would like to ask you something. We are launching the workflow from a file which has a type with a property called "Departament". The Departament value is the name of the alfresco Groups the workflow needs to assign the task… so now dont know exactly how to specify the group dinamically.

we have tried something like


<userTask id="iniciar" name="Revisar JefeDpto" activiti:candidateGroups="GROUP_test.children[0].properties["hula:department"]" activiti:formKey="wf:activitiReviewTask">


or something like


<userTask id="iniciar" name="Revisar JefeDpto" activiti:candidateGroups="GROUP_"+${test.children[0].properties["hula:department"]}+" activiti:formKey="wf:activitiReviewTask">


but it does not work.

Any sugestions about how could we get this property and use it to assign the task to the right group??

Thanks a lot!!

afaust
Legendary Innovator
Legendary Innovator
Hello,

you can't do something like this even with expression language. For one, the GROUP_test is just a string and not a feature object you can use to query members from. Secondly, concatination in XML is not a thing and the example with the expression results in invalid XML.

The only way to handle such a use case is to use task listeners (either Java or script) to execute some code when the task is created to set the candidate groups dynamically. Within Java or script you can use the Alfresco (Script) API to lookup particular authorities and iterate over their members.

Regards
Axel

mitpatoliya
Star Collaborator
Star Collaborator
ok there is one more thing you need make sure.
If you are using Alfresco Explorer you need to configure your dashboard to add pooled task dashlet.
and in Share you need to make sure you are checking the pooled tasks list.

cherry0103
Champ in-the-making
Champ in-the-making
Hi erveryone!
I want to assign to a group from my form selection. I use:
activiti: candidateGroups="${bpm_groupAssignee.properties.authorityName}" but when I submit Task, the exception throw:
Failure
org.activiti.engine.ActivitiException: Unknown property used in expression
My definition Task is:

<userTask id="kiemtranoidungthethuc" name="Kiểm tra nội dung, thể thức VB- Chuyển cho phòng TCHC" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wfdi:kiemtranoidungthethucTask_tc">
    <extensionElements>
         <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
              <activiti:field name="script">
                <activiti:string>
                            if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
                          if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;

                </activiti:string>
              </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
              <activiti:field name="script">
                 <activiti:string>     
                        execution.setVariable('wfdi_userVanthu', person);                       
                        execution.setVariable('wfdi_chapthuan_tc', task.getVariable('wfdi_chapthuan_tc'));     
                        execution.setVariable('bpm_dueDate', task.getVariable('dueDate'));
                        execution.setVariable('bpm_priority', task.priority);  
                        execution.setVariable('bpm_groupAssignee',task.bpm_groupAssignee);

                 </activiti:string>
              </activiti:field>
          </activiti:taskListener>         
    </extensionElements>
</userTask>
<userTask id="kiemtrathethucchuky" name="Phòng TCHC - Kiểm tra thể thức, chữ ký - Chuyển cho BGH"
activiti:candidateGroups="${bpm_groupAssignee.properties.authorityName}" activiti:formKey="wfdi:kiemtrathethucchukyTask_tc">
    <extensionElements>
    <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
      <activiti:field name="script">           
            <activiti:string>
                        if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_priority;
            </activiti:string>
      </activiti:field>
    </activiti:taskListener>
    <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
      <activiti:field name="script">
        <activiti:string>      
                        execution.setVariable('wfdi_kiemtra_tc', task.getVariable('wfdi_kiemtra_tc'));     
                        execution.setVariable('bpm_dueDate', task.getVariable('dueDate'));
                        execution.setVariable('bpm_priority', task.priority);
        </activiti:string>
      </activiti:field>
    </activiti:taskListener>
  </extensionElements>
</userTask>


I don't know how to fix it. Thank in advance!