Continued from Part I.
Description/Configuration of activities continued.
3.Activity Name : Validation, Type : Human Interaction
User Interface : WebDynpro component ValidationComp with a view ValidationCompView with a ‘Validate’ button. This button will just fire the ‘Complete’ event to complete the task. You can display other UI elements on the screen or add business logic on click of ‘Validate’ button. This screen also has a ‘TextView’ for displaying the UniqueID of the Validation group that will validate a particular request. It is bound to a value attribute ‘Validator’
Configuring Looping for ‘Validation’ activity:
Looping configuration will enable the parallel(multiple instances) of the ‘Validation’ activity.
Select the ‘Parallel for Each’ radio button and select the ‘Select collection’ radio button:
Select the ‘DO_ContextTypeINPUT/Context/ListOfIDs’ collection in the collection dropdwon. This assignment will give the limiting condition for looping. The number of instances of this activity will be created equal to the number of elements in the ‘ListOfIDs’ collection.
After this configuration two new Process Context objects are created for this activity. Namely: ‘currentCollectionItem’ and ‘numberOfCompletedIterations’. They are local to only this activity and cannot be used by other activities. The ‘currentCollectionItem’ holds the pointer to the currently selected Item from the collection for the activity instance and the ‘numberOfCompletedIterations’ will give us the number of completed loop instances.
Due to our assignment of the ‘DO_ContextTypeINPUT/ListOfIDs’ collection to the collection dropdown for looping, the attribute ID gets created under ‘currentCollectionItem’ object.
We will use ‘currentCollectionItem->ID’ to dynamically assign the Potential Owner to the Validation Task. By doing this we will assign the ‘Validation’ task to each of the ‘Validation’ groups in parallel and in turn to the group members of those groups. If any validator from a group validates i.e. completes the task, the task will be completed for the whole group. However, in order to move to the Approval phase, the validation from all the validation groups needs to be completed.
Now lets configure the Dynamic Potential Owner Assignment using ‘currentCollectionItem’:
First, in the task tab of the ‘Validation’ activity, select the ‘Potential Owner’ checkbox. This will add another sub-tab ‘Potential Owner’ under the ‘Task’ tab.
In this sub-tab we can use expression to assign the potential owners to the activity:
We wil use the getPrincipal(string principalID) function to get the principal. We use the following expression : getPrincipal(currentCollectionItem/ID)
When this expression is evaluated at runtime, it assigns the IDs in the ‘currentCollectionItem->ID’ i.e. the uniqueId of the Validation Groups and assigns the groups as the Potential Owner for each activity instance.
Now we can understand that we achieved two objectiveses by the ‘ListOfIDs’ node/collection:
1. Created the number of activity instances equal to the number of elements in the node/collection
2. Used the group ids from those elements and made them the potential owners of the ‘Validation’ activity instances in parallel.
4.Activity Name : Approval, Type : Human Interaction
User Interface : WebDynpro component ApprovalComp with a view ApprovalCompView with a ‘Approve’ button. This button will just fire the ‘Complete’ event to complete the task. You can display other UI elements on the screen or add business logic on click of ‘Approve’ button.
Thus, we configured the activities and Data Object, Mappings, looping and Dynamic Assignment of the Potential Owners based on the object ‘currentCollectionItem‘ generated in the activity’s local process context .
Now it is time to build and deploy as usual, and run the Process to see the outcome.
We will see the Process run part in the next part of this blog.
Links to the Parts
Parallel (multi-instance) Activities in BPM CE 7.2 – Part I
Parallel (multi-instance) Activities in BPM CE 7.2 – Part II
Parallel (multi-instance) Activities in BPM CE 7.2 – Part III
Parallel (multi-instance) Activities in BPM CE 7.2 – Part IV