Modifying Approval Task
The Task has a task metadata and assignment section, which has the stages defined. There can be many participants in a stage. You can set properties on the participant to determine routing (serial or parallel) for the task. There are two kinds of participants value-based and rule-based.
You have created a rule based participant in Chapter 5. Rule-based participants are also called rulesets, and approval routing rules are authored inside a ruleset. It's the ruleset that you would view in the Oracle BPM Workspace and BPM Worklist applications.
How to do it...
You will modify the BusinessAnalystReview task so that it will be based on business rules:
1. Open JDeveloper in the default role.
2. Go to project SalesToContact | BusinessAnalystReview.task in the Project Hierarchy.
3. In the Task metadata, click on the Assignments section.
4. Double-click on the participant block.
5. Follow the ensuing details to create a list builder based on Rule.
6. Enter name of List Ruleset as
DynamicApprovalGroup:
7. This will create Decision Service components and a Ruleset in it. The following is the Decision Service component:
8. Click on Create Rule.
9. Create a Rule with name
DynamicApprovalGroupRule
and invoke the CreateApprovalGroupList API with the following parameters:Name of the Group:
DynamicAG:
This is the name of the dynamic Approval Group, which you have created in BPM WorkspaceallowEnptyApprovalGroup: true
responseType :ResponseType.REQUIRED:
As it's an Approvers list and not a FYI list, we would use the ResponseType requiredrule Name: Enter the Rule name DynamicApprovalGroupRule
lists: Lists:
10. Deploy the process as outlined in the Deploy BPM projects section in Chapter 3, Process Deployment and Testing.
How it works...
When the process token reaches for approvals, it would be routed to the stages defined in task metadata, and inside these stages there are participants. You have defined participants as rule-based, and hence an approval rule gets executed. Rule name will identify the rule and when the condition gets satisfied, the Rule gets executed. Rule will build the participant list based on the List Builder Approval Group.
Approval Group will be defined in the Oracle BPM Workspace; it will invoke a Java class, which in turn calls the PL/SQL procedure to dynamically build the list of participants. These participants will be returned to the Rule, and tasks get assigned to them. Based on the response type, it's decided if the participant will act on the task or if it is a FYI participant:
There's more...
Once you have deployed the process, you can verify task configuration from the Oracle BPM Workspace and BPM Worklist applications.
Verifying configured task
To verify configured tasks, you have to log in to Oracle BPM Workspace application with admin role. You can even change task configuration from here. Follow the ensuing steps:
1. Log in to Oracle BPM Workspace at
http://localhost:8001/bpm/workspace
.2. Click on Administration Areas | Task Administration | Task Configuration. To configure the Task section, click on BusinessAnalystReview(1.0). This is the task that you have modified to include the business rule for dynamic approval. Task is here as a part of the process being deployed, which has BusinessAnalystReview.task.
3. Click on the Data Driven tab and select the Ruleset DynamicApprovalGroup.
4. Expand DynamicApprovalGroupRule, which will get listed when you select the ruleset.
You can verify the Approval Group listed that you have entered in the business rule in JDeveloper.