cancel
Showing results for 
Search instead for 
Did you mean: 

HELP ! Setting Multiple Assignees on the fly!

irenailievska1
Champ in-the-making
Champ in-the-making
I kind of hit a wall with Activiti with this one- I need to pass multiple assignees in a task, but the current user chooses the next people. I did it for just one person, but I can't find why I can not do the same thing for more than one person.
It appears as if the object picker selects only the first person and leaves all the rest.
I have created person association in my custom model shown below:

<aspect name="swf:assignees1">
   <associations>
         <association name="swf:assignees1">
         <source>
            <mandatory>false</mandatory>
            <many>false</many>
         </source>
         <target>
            <class>cm:person</class>
            <mandatory>false</mandatory>
            <many>true</many>
         </target>
      </association>
   </associations>
</aspect>   


Then in the current task i set the value of the swf:assignees1 field to a variable in the process. This is so that the next task will use the collection swf_assignees1 with variable assignee reviewAssignee

execution.setVariable('swf_assignees1',task.getVariableLocal('swf_assignees1'));

But in the end I only end up getting only the first value.

Can somebody help me? This is very important for the project I am currently working on.

Thank you in advance,
Irena
2 REPLIES 2

vasile_dirla
Star Contributor
Star Contributor
considering this: "I need to pass multiple assignees in a task"

I understand you want to have a UserTask (t1) which should be assigned to multiple users (u1, u2, u3)
now I ask you: What do you expect to see in my tasks of each assigned user and what's happening when one of these users will complete the task?

maybe the current "candidate users" implementation does satisfy your needs ?

Hi, thank you for your reply but I found the "mistake" - if that can be classified as a mistake. Apparently I shouldn't initialize all the other aspect associations at the beginning of the subprocess ( inside an extensionElements tag) - I was setting them to be empty like this
<code>
extension.setVariable('swf_subAssignees2','');
…………..
</code>
So when I tried the code without that piece of code it worked as it should. I have no idea why would this happen.
Maybe somebody knows why this occurs?