I would like to be able to pass a list of users as candidates for a task. The users are retrieved from a data list and not available as a group. Activiti:candidateUsers would appear to be the right approach.

Assuming that the users have been obtained and set in the variable, ipw_reviwers.

<serviceTask id="alfrescoScripttask1" name="Alfresco Script Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
  <extensionElements>
    <activiti:field name="script">
      <activiti:string>logger.log("IPW - setup task");
      execution.setVariable('ipw_reviwers', "tom, dick, harry");</activiti:string>
    </activiti:field>
  </extensionElements>
</serviceTask>

The following to uses the variable ipw_reviewers

<userTask id="adhocTask" name="Adhoc Task" activiti:candidateUsers="${ipw_reviewers}" activiti:formKey="wf:activitiReviewTask">
  <extensionElements>
    <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
      <activiti:field name="script">
        <activiti:string>logger.log("IPW - create task");
        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>
  </extensionElements>
</userTask>

No one is able to see or claim the task. If there is only one user in the list, that user is able to claim the task.

If activiti:candidateUsers is declared as

activiti:candidateUsers="tom, dick, harry"

then all three users are able to claim the task.

Can

Edit
Report