BPM 11g - Dynamic Task Assignment with Multi-level Organization Units
- by Mark Foster
I've seen several requirements to have a more granular level of task assignment in BPM 11g based on some value in the data passed to the process. Parametric Roles is normally the first port of call to try to satisfy this requirement, but in this blog we will show how a lot of use-cases can be satisfied by the easier to implement and flexible Organization Unit.
The Use-Case
Task assignment is to an approval group containing several users. At runtime, a location value in the input data determines which of the particular users the task is ultimately assigned to.
In this case we use the Demo Community referenced in the SOA Admin Guide, and specifically the "LoanAnalyticGroup" which contains three users; "szweig", "mmitch" & "fkafka". In our scenario we would like to assign a task to "szweig" if the input data specifies that the location is "JapanCentral", to "fkafka" if the location is "JapanNorth" and to "mmitch" if "JapanSouth", and to all of them if the location is "Japan" i.e....
The Process
Simple one human task process....
In the output data association of the "Start" activity we need to set the value of the "Organization Unit" predefined variable based on the input data (note that the predefined variables can only be set on output data associations)....
...and in the output data association of the human activity we will reset the "Organization Unit" to empty, always good practice to ensure that the Organization Unit will not be used for any subsequent human activities for which we do not require it....
Set Up the Organization Unit
Log in to the BPM Workspace with an administrator user (weblogic/welcome1 in our case) and choose the "Administration" option.
Within "Roles" assign the "ProcessOwner" swim-lane for our process to "LoanAnalyticGroup"....
Within "Organization Units" we can model our organization.... "Root Organization Unit" as "Japan" and "Child Organization Unit" as "Central", "South" & "North" as shown. As described previously, add user "szweig" to "Central", "mmitch" to "South" and "fkafka" to "North"....
Test the Process
Invalid Data
First let us test with invalid data in the input to see what the consequences are, here we use "X" as input....
...and looking at the instance we can see it has errored....
Organization Unit Root Level Assignment
Now let us see what happens if we have "Japan" in the input data....
...looking in the "flow trace" we can see that the task has been assigned....
... but who has the task been assigned to ? Let us look in the BPM Workspace for user "szweig"....
...and for "mmitch"....
... and for "fkafka"....
...so we can see that with an Organization Unit at "Root" level we have successfully assigned the task to all users.
Organization Unit Child Level Assignment
Now let us test with "Japan/North" in the input data....
...and looking in "fkafka" workspace we see the task has been assigned, remember, he was associated with "JapanNorth"....
... but what about the workspace of "szweig"....
...no tasks assigned, neither has "mmitch", just as we expected.
Summary
We have seen in this blog how to easily implement multi-level dynamic task routing using Organization Units, a common use-case and a simpler solution than Parametric Roles.