cancel
Showing results for 
Search instead for 
Did you mean: 

Assign a Workflow User Task to multiple users

wattsshane
Champ on-the-rise
Champ on-the-rise

In my custom workflow, I want to assign a user Task to multiple users so I have set a variable

 execution.setVariable('assigneeList', ['admin','signer1']); 

even tried  execution.setVariable('assigneeList', [admin,signer1]); 

And this is multiInstanceLoopCharacteristics code 

<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="assigneeList" activiti:elementVariable="assignee">
</multiInstanceLoopCharacteristics>

I am not able to assign my list of users in the workflow , I am getting errors .  Can anyone please help me how I can assign the above list of users to a user Task.

imageError 1imageError 2

1 ACCEPTED ANSWER
4 REPLIES 4

angelborroy
Community Manager Community Manager
Community Manager

Try using the Java approach:

var ArrayList = Java.type("java.util.ArrayList");
var assigneeList= new ArrayList;
assigneeList.add("admin");
assigneeList.add("signer1");
execution.setVariable("assigneeList", assigneeList);
Hyland Developer Evangelist

Dear Angel ,

Thanks for your response, Im getting Java error after following your method

This is my listener 

<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[

--"-----"------"-----------------------

var ArrayList = Java.type("java.util.ArrayList");
var assigneeList= new ArrayList;
assigneeList.add("admin");
assigneeList.add("signer1");
execution.setVariable("assigneeList", assigneeList);
]]></activiti:string>
</activiti:field>
</activiti:taskListener>

Kindly assist on this.

image

Why are you using "Java.type"?

You may try this approach: https://github.com/flowable/flowable-engine/blob/main/modules/flowable-secure-javascript/src/test/re...

Hyland Developer Evangelist

Worked Perfect, Thanks for the help .....