Task Forms in Tasklist

Hi to everyone,

I would like to mention 2 issues which I face with my user forms in Tasklist.
First of all, in my process, I have created a group of 5 users who are all assignee for one user task. They work independently because everyone of them executes the same task for his/her own faculty of the same university.
In my BPMN Diagram I have defined their group (Local Administration) as the Candidate Group for this user task.
My issue is that when one of these 5 users (local administrators) signs in his/her account in Tasklist, claims this task (which must be executed by all the users of this group) and completes it, the other 4 users (who are also assignee for this task) can not see and claim it in order to execute.
It is considered somehow that the task is completed although it must be executed by all the users of this group.
Has anyone any idea on this aspect?

Thank you in advance,
@steftriant

@steftriant you need to use Multi-Instance:

Look at this for the concept of looping over list: Pattern Review: DMN Looping for Array Input

You scenario would look something like:

See: Task Markers | docs.camunda.org

Hi @StephenOTT.
First of all, thanks for your post and help here.
I caught the central meaning of multi-instance tasks, I rendered the desired user task in my process as a parallel multi-instance user task by using the loopCardinality property (I set it equal to 5 since I want for this task to be executed by 5 different users in the same process).
When my process reached this task, I saw in the tasklist the creation of 5 tasks for this one.
The only aspect that I want to make clear here is that I want for the user who claims and completes this task to be able to continue to the next stage of the process and not to wait the rest of the group (the other 4 users) to claim and complete also this task.
Soon, I am also going to upload here my bpmn file with the relative process in order to make clearer the things.

Regards,
Steve

So what pub want to do is set the assignee field to the collection variable in the multi instance and then set your collection to be a array of usernames.

Each task that gets instantiated will be assigned to one of the users.

Did you review the forum post link I provided

@steftriant here is a working example using a SPIN json array/collection

multiInstance-userAssigneeTest.bpmn (4.0 KB)

var names = S(JSON.stringify({"names":["chris","steve","frank"]}));
execution.setVariable('assignees', names);

Hi again @StephenOTT and sorry for my delayed response but concurrently I have been trying to overcome other issues besides this one in my process :confused:
I took a careful look again at the relative chapter (Task Markers | docs.camunda.org) and I have the impression that I must follow the highlighted lines of the above link in the following screenshot:


So, I think that the value “5” which I set in the Loop Cardinality field is not necessary.
I uploaded this time the bpmn file with my process in case you could help me of course as I am a bit confused with this point.
I want for the 2nd user task (the parallel multi-instance task) to be executed by 5 different users who all are local administrators. Each one works independently of course and when he/she completes this task, he/she must continue to the next task in the process regardless of the rest of the group. I have defined their group as the Candidate Group for this task so I think this is the reason why each member of this group must claim the task first in order to do it.
I haven’t got any script task in my process.
I hope to have made clearer my issue.
Electronic Equipment Competitions2.bpmn (21.5 KB)

Thanks a lot,
Steve

@StephenOTT, I meant the 3rd user task (Select products) in my process, sorry.

Steve

@steftriant i think you need to use Sub-Processes with Multi-Instance.

See:

Your explanation is a little hard to follow. If you can more clearly explain the scenario that would help as well.

Hi @StephenOTT.

Yes, sure. In my scenario, one user (the central administrator) submits in a form the categories of a plethora of electronic products (laptops, desktops, printers, screens, e.t.c.) (1st user task in my process) and shortly after the same user submits in an other form the description and the price for each of the above electronic products (2nd user task in my process).
5 other users (local administrators) who all belong to the same group (local administration), see in their forms the submitted electronic products (the categories, the description and the price for each one) and they have to select from a list some of these products (3rd user task in my process), according to the needs of their faculty. All of these 5 users work for the same university but each one works for his own faculty independently from the other ones.
Once someone of this group of 5 users makes his final selection, a control is taken place by a Java API in order to check if the budget of the user’s faculty covers the total cost (the first service task in my process) and if the selected list of products is cheaper than the faculty’s budget, the process continues to the next stage (user task: Gather needs). Otherwise (the faculty’s budget is lower than the total cost), the respective user has to negotiate some of his selections and he is obliged to execute again the same task (3rd user task in my process) until his budget exceeds the cost of selected products. I want from the user who completes the selection to continue with the process regardless of the rest of 4 users.
If you take a look at my bpmn diagram, you will see that I have defined this group as the Candidate Group for this task (Select products) and I have the impression that this is wrong because when the central administrator completes his first 2 tasks, every user of the group of local administration must claim the next task (select products) in order to make his selection.
Hope this makes sense :slight_smile:

Thanks,
Steve

var names = S(JSON.stringify({"names":["chris","steve","frank"]}));
execution.setVariable('assignees', names);

Hi @StephenOTT.

I would like to ask you something concerning the array “names” in your working example here above using SPIN json array/collection.

If this array consists of a big unknown number of users, how can I define it in the script task?

Thank you,
Steve

Can you provide more detail to what you mean by “define it” ?

Yes, of course.
I mean that you had defined it as a JSON variable in the script task like this:

var names = S(JSON.stringify({"names":["chris","steve","frank"]}));
execution.setVariable('assignees', names);

In this case, the array (“names”) consists of 3 users (chris, steve, frank).
I would like to do something like this, but for an array which consists of much more users whose number is unknown.

Thanks,
Steve

Where is the values coming from?

So in practice you would do something like:

var myList = someVariableThatIsAList
var names = { "myList": myList }

S(JSON.stringify(names));
execution.setVariable('assignees', names);

My scenario is this one:

The number of representatives(who are assignees for the 2nd user task) is unknown in advance and big (e.x. 30 users).
The values are coming from the 1st user task which is submitted from 1 user only.
So, in my case I suppose that I have to write this script in the Script Task but I’m not sure:

var myList = items
var representatives = { "myList": myList }

S(JSON.stringify(representatives));
execution.setVariable('assignees', representatives);

Please let me know if I’m correct.
Thanks,
Steve

So in your example @steftriant in Create List user task you have some sort of UI that someone selects a bunch of users from. Lets assume that produces a JSON array on the UI side. You need to save that array into a variable that you can then inject into the collection.

Assuming items is the array from the UI, your code should look like:

var myList = items
var representatives = { "myList": myList }

var mySpin = S(JSON.stringify(representatives));
execution.setVariable('assignees', mySpin.prop('myList').elements());

Then in your collection field for the multi-instance you are doing a ${assginees}

Yes @StephenOTT, if I correctly understand, you mean this one:

In the 1st user task, the user creates a list of items which is a created JSON array via camForm function.
The created variable (list of items) is sent (is injected into a collection as you said) to a big and unknown number of users (representatives) who must select from this list.

So, on the submission of the 1st task, I want to assign only 1 task to each representative.
Based on your initial example here I had written the following ones in the Multi-Instance task:

I’m not sure if I’m correct with the 2nd screenshot.

Steve

In your Assignee field, where are you getting idea to add .value()? If you go back to the original DMN pattern example your scenario is nearly identical. Instead of the list of names coming from a script task it is coming from your Form. See the DMN pattern example and look at the specific configuration.

You should be removing the .value() from the assingee field.
The Collection field looks correct.

The idea was from this old post above in this topic which was yours:

So what pub want to do is set the **assignee field** to the collection variable in the multi instance and then set your collection to be a array of usernames.

Each task that gets instantiated will be assigned to one of the users.

Did you review the forum post link I provided

image

In my current example the list of items is coming from the form and the list of names (representatives in my case) is coming from the script task if I am correct.

When you get a list of elements, there is no properties just a list.

Look at the example:

Where the collection is the .elements(), but the element variable is just collName and in the Placeholder user task, i have ${collName}. There is no .value() because you are just reading from a list of strings. There is no KeyValue pairs / objects that are being read, this no .value()

You mean that in the Assignee Field of your Placeholder User Task you 've only written the Element Variable (collName). If I correctly understand, .value() refers to KeyValue pairs/objects?