Task Forms in Tasklist

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?

In the image above, in the Title of the user task it shows ${collName}. That is a dynamic task title that is based on the value of collTitle.

Have you tested your code? Test with .value() and without .value(). Assuming you are building your object correctly with an array of strings, then it should work without the .value(). and should throw an error when using .value()

@StephenOTT thank you very much again for your time, glad to talk with you, but I’m going to log out now.
I will take into account anything you told me here today and I will let you know of course for the testing asap.

Cheers,
Steve :slightly_smiling_face:

Hi again @StephenOTT.

If you see again your post here Pattern Review: DMN Looping for Array Input and more specifically your part:

Here is a updated version that uses JSON objects and javascript throughout:

array_test.dmn 57 (1.4 KB)
array-input-dmn.bpmn 56 (7.8 KB)

Few major changes were needed to accommodate JSON objects:

adding .value() to the input expression of the DMN. So now the expression for the input is: collElement.value().

The Collection field of the Business Rule Task, in the Multi-Instance section was set to: ${collection.prop("collection").elements()}. An interesting aspect was that when the elements are passed to the DMN they are still passing as JSON rather than a String. And this is occurring even though the JSON is not valid json. @camunda this is a possible bug? Basically each element that was passed in the DMN was Typed as JSON but when you inspected the data in the cockpit it would show the value of the JSON object as something like System 1. No array, no JSON brackets, etc. So it would appear as a String.

Array Generation was changed to:

var collection = S('{ "collection" : ["System 1", "System 3"] }');
execution.setVariable("collection", collection)

var jsonValue = S('{ "values":[] }')

execution.setVariable("combinedResult", jsonValue)

you had added the .value() to the Element Variable field of the Multi-Instance Business Rule Task.

And in another post of yours in this topic above, you had written to me this one:

set the **assignee** field to the **collection variable** in the **multi instance**

where collection is an array of strings.

So, this is why I had added .value() in the Assignee field of my Multi-Instance User Task. :wink:

Steve

@StephenOTT what do you mean exactly by this one?

Thanks,
Steve

@steftriant look at the screenshot i posted. Look at the literal title of the task. It has a expression in the title.

@steftriant can you porovide a sample bpmn, form, etc that you are working with. I can help you with a working file set.

@StephenOTT you mean that a dynamic title of a task is the expression ${Element Variable}.
Yes, of course. My bpmn process scenario is this one:
diagram_1.bpmn (14.0 KB)

Steve

When you run your bpmn, do you get errors?

I haven’t run my bpmn yet because I’ve changed a bit my initial process scenario.

In addition, I was obliged to download the last edition release of Camunda BPM because I couldn’t run any web app with my previous one.

I run locally my process application in Apache Tomcat Server and I load any task form from my Eclipse IDE (html forms).

Steve

@StephenOTT, I will let you know of course for any possible error when I run my bpmn process.
My task names are in Greek.

Steve

Hi @StephenOTT.

I would like to ask you sth based on our last discussion here.
In my process scenario there are 6 groups of users.
Each one of those groups has 2 categories (roles) of users (Local Administrators & Representatives).
So, my question is how can I assign my parallel multi-instance user task to one of those 2 categories only (e.x. Representatives) ?
I ask this because in each one of my 6 groups some users are Local Administrators and some others are Representatives and I don’t know exactly how can I distinguish them :confused:

A screenshot of my process diagram

The inline script of my Script Task

var myList = product
var representatives = {"myList" : myList}
var mySpin = S(JSON.stringify(representatives));
execution.setVariable('assignees', mySpin.prop('myList').elements());

Screenshots of my parallel multi-instance user task


Thanks a lot in advance,
Steve

Can you provide a example of the data structure you have in your list?

Yes of course.
What do you mean exactly by data structure of my list?
I have 2 lists:
The list of products whose values are coming from my 1st User Task (Create a list of products) by camForm function as a JSON Array.
The list of users which is created in the Script Task (Create Array). But my issue is that I want to assign my 2nd User Task (Select from the list of products) only to users who have the role of Representative. And each one of my 6 groups is mixed as far as the role is concerned because some users are Representatives and some others are Local Administrators.
One solution could be to divide my users into these 2 categories based on their role in process but I 'm not sure if there is a better solution :face_with_raised_eyebrow:
This is why I posted yesterday the following here:

Thanks a lot,
Steve

The way you are describing your data is confusing. You are mixing words of groups, roles, categories, products, arrays, etc.

(Select from the list of products) only to users who have the role of Representative. And each one of my 6 groups is mixed as far as the role is concerned because some users are Representatives and some others are Local Administrators.

The above does not make sense to me in the way you wrote it.

I ask that you break down your data structure and scenario in more clear and explicit step by step.

From what i can tell you have something like:

A list of Users who have Roles. A user can be a Admin or a Rep.
Each user is part of one “group”. There are 6 groups.
You have a list of products, and each product is part of 1 Group
Someone selects N products and for each product selected you want to assign the Admin and Rep of that Product to the User Task.

Ok, sorry if I was not so clear.

The groups of users are totally 6. Each group has both Local Administrators and Representatives.
Roles and categories are the same thing. In my process there are 3 roles totally (1 Central Administrator, a number of Local Administrators and a number of Representatives). I know their number.
One user (the Central Administrator) creates the list of products in the 1st task. This list is a JSON Array and must be sent to any Representative afterwards.
If you take a look in my Script above (in the Script Task) you may understand what I did.
My issue is that I want to automatically assign only 1 instance of my 2nd user task (the parallel multi-instance) to all the users who have the role of Representative.

Hope this makes sense :slightly_smiling_face:
Steve

You cannot assign a single instance of a user task to multiple users.

Can you clarify this.

What do you mean?
If the task is multi-instance, you can’t automatically assign only 1 instance of this task to a number of users? I don’t want from the user to be obliged to claim the task in order to complete it.

You are talking about Multi-Instance:

So there is the Parent activity which is the overall Multi-Instance, and each “Instance of the Multi-Instance”. You cannot assign a Single Instance of a user Task to more than 1 user (a task cannot be claimed by more than 1 user at the same time).