Assign a Workflow User Task to multiple users

cancel
Showing results for 
Search instead for 
Did you mean: 
wattsshane
Active Member

Assign a Workflow User Task to multiple users

Jump to solution

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.

Error 1Error 1Error 2Error 2

 

1 Solution

Accepted Solutions
angelborroy
Alfresco Employee

Re: Assign a Workflow User Task to multiple users

Jump to solution

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

View solution in original post

4 Replies
angelborroy
Alfresco Employee

Re: Assign a Workflow User Task to multiple users

Jump to solution

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
wattsshane
Active Member

Re: Assign a Workflow User Task to multiple users

Jump to solution

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.

 

java_error.JPG

angelborroy
Alfresco Employee

Re: Assign a Workflow User Task to multiple users

Jump to solution

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
wattsshane
Active Member

Re: Assign a Workflow User Task to multiple users

Jump to solution

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