In BPM projects, Organizational Units (OU) describes the departments or offices into a company that are involved in a business process. These departments or user groups maybe are not in an “official” organizational chart necessarily, but they have a meaning to the business process.
When a project is created using Oracle BPM Studio, there is a file called “organization.xml” that is created. This file contains the roles, organizational units, calendars and holidays.
Case Study: Assign a Task by Organizational Unit
In business processes normally there are cases when you need to approve one task but only the participants related with a department, e.g.: If one vacation request must be approved by the department manager. If one is from a Marketing employee, the Marketing manager should approve that request.
Creating the Process
- We will create a BPM project with a process as simple as the following:
- Then we can define a Business Object (with or without a XML Schema) like this one:
- Implement a Human Task using the wizard:
We can run this process with “weblogic” user as a participant in the “approver” role and test it.
Adding Users and Organizational Units
After testing the process, we can add some users and OUs.
- To create users, we can use the administration console from WebLogic or we can use WLST. Check this post from Edwin Biemond: http://biemond.blogspot.no/2010/01/creating-users-and-groups-in-weblogic.html
In this case, I have created these users:
And all these ones belong to the group “approvers”
- Double click on “Organization” into the BPM project. Create these Organizational Units:
- Assign the WebLogic group to the BPM role:
We can test the process now. All the users should have access to one task until some user claims it.
But, if the requirement is “The requests must be assigned to and approved by the Department Manger” we can use different approaches: Get the manager from a Business Rule task, from a Service, call a Business rule directly from the Human Task, we can use Parametric Roles, or use Organizational Units :D.
I think that when the requirement says “by department” or “by office” we should use Organization Units. Here is how to:
Using Organizational Units
- Select which Organizational Unit must be related with the BPM project. When the OU is in the project, use the second option, if the OU is in BPM Workspace use the third one:
We must check that all the users, groups and roles used in the assignments must be part of the Organizational Units under the selected root (including the root). If a participant is not included, the task will not appear on BPM Workspace.
- Then, we should tell the process with which OU must work:
But what if the ID attribute coming from the Database is not related with my Organizational Unit name? In these cases we can use a Domain Value Map. This artifact let us define a relation between different domains. With this is not necessary to create tables to map values, or create boiler-plate code e.g. if we have a code on SAP and another one on BPM, we can use a DVM to match them.
- Create a DVM and add two columns “DB” and “BPM”
Once created we can add values:
- We can use XPath functions to get values from DVM artifacts. Let’s edit the data mapping in the start event:
The function should have this parameters:
dvm:lookupValue("dvm/Department.dvm", "DB", string(bpmn:getDataOutput('request')/ns:departmentId), "BPM", "ACME")
Now we can deploy and test the task assignments. The task must be assigned only to the Department approver.
Source Code: https://github.com/jeqo/bpm_org_poc