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.
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.
@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)
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
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
This is why I posted yesterday the following here:
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.
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.
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.
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).
You need to explain the actual process you are trying to create:
Do the Rep and Local Admin both have work to complete? Is it the first person to complete the task? Why cant they claim the task? etc