Multiple user task instances

The difference in the execution of sequential and parallel task instances becomes apparent in the user tasks.

A useful example of a sequential user task, with its attached form and a number of participants, is that all participants are required

  • to validate some of the information contained in the form and / or

  • to build on the results of the other participants

This does not apply to parallel user tasks because they are created at the same time and therefore are independent of each other in terms of content.

Providing form data

For this reason, the provision of form data differs between sequential and parallel user tasks instances.

Please refer to the topic "Providing Form Data" to learn about the simple and standard modes used in the sequential user task instances.

When using parallel user tasks, both modes are not sufficient because all users would see the same form with the same data. In addition, changes made by one user to the data are visible to other users and users can override the other data. Therefore, the parallel user task uses an advanced mode to provide the form data. Instead of having all form data combined in a dictionary, as in standard mode, a dictionary with one entry is used for each collection entry. The keys to the dictionary are the values provided by the collection. The values are again a dictionary of form values.

Example

bild2

The following workflow properties have been set for the parallel user task:

NewItem1003

The "Prepare Data" script task provides the collection of the users who will receive a task as well as any needed data for the form data.

The workflow expression of the preparation task consists of this Python code:

Recipients = ["paul.paulo@example.com", "justin.justice@example.com"]
FormData = {}

So we have an array Recipients with the email addresses of the users to whom we want to assign a task, and a dictionary FormData where we want to store the data from the form.

In the participants expression of the "Collect Information" user task, the recipients of the user task are set. This is done with the following Python code:

Result = Token.Attributes["User"]

We obtain a value of the collection by addressing its element variable with Token.Attributes, which gives us the participant of the user task in this case.

When the parallel user tasks are completed, the data of FormData would look like this:

FormData = {"paul.paulo@example.com": {"Text": "Hello World"}, "justin.justice@example.com": {"Text": "Good
Morning"}}

The workflow can then use the collection to access the data that users specified in the form.

Extended example

As explained in Providing form data, the parallel user task uses an advanced mode to provide the form data. In order for the advanced mode form data to be used in standard mode, the data structures must match. Therefore, the form data of a multiple user task must be prepared prior to use in a single user task.

z

The following workflow properties have been set for the parallel user task:

NewItem1003

The "Prepare Data" script task provides the collection of the users who will receive a task as well as any needed data for the form data.

The workflow expression of the preparation task consists of this Python code:

Recipients = ["paul.paulo@example.com", "justin.justice@example.com"]
FormData = {}
MultipleFormData = {}

So we have an array Recipients with the email addresses of the users to whom we want to assign a task, a dictionary FormData and a separate dictionary MultipleFormData where we want to store the data from the form of the parallel user task.

In the participants expression of the "Collect Information" user task, the recipients of the user task are set. This is done with the following Python code:

Result = Token.Attributes["User"]

We obtain a value of the collection by addressing its element variable with Token.Attributes, which gives us the participant of the user task in this case.

When the parallel user tasks are completed, the data of MultipleFormData would look like this:

MultipleFormData = {"paul.paulo@example.com": {"Text": "Hello World"}, "justin.justice@example.com": {"Text": "Good
Morning"}}

If, for example, the information gathered in the parallel user task is to be displayed in "Display Information" in a data grid, the values of the two keys in the dictionary MultipleFormData must be transferred into the variable of such a data grid in FormData. This could be done with the following Python code:

FormData["Grid"] = MultipleFormData.values()

The data of FormData would look like this:

FormData = {"Grid": [{"Text": "Hello World"}, {"Text": "Good Morning"}]}
Users do not always have to be addressed via Token.Attributes or the collection does not always have to refer to the users in a parallel / sequential user task. The collection may also refer to form data or the like. It only has to be clear to the workflow which user task to assign to which user.