AVIO Consulting

Using a Multi-Instance Subprocess as a Complex Gateway in Oracle PCS

Oct 23, 2017 | BPM

To speed the time it takes for a work item instance to flow through a process, copies of the instance can be sent to people in multiple roles simultaneously in the Oracle Integration Cloud Process Cloud Service (PCS).  Someone in each of the roles can then approve or reject the work item instance.  The challenge comes when an early release from all of the parallel copies is desired when anyone in any of the roles rejects their instance and the original work item instance should then continue in the process. 

                                                                                                                                                                                                  

The Business Process Model and Notation (BPMN) has a complex gateway artifact with this process pattern in mind. When needed, the complex gateway’s early release capability makes it one of the most powerful tools process modelers have today when designing executable BPMN processes.  Currently, PCS does not support complex gateways. Because its functionality often needed, this blog describes how to duplicate its functionality when modeling processes using PCS.                                                                                                                                                                                                          

 

Recently added to PCS in May 2017, I recommend that the use of a multi-instance subprocess to do this because:                        

  • One of the multi-instance subprocess activity’s options is to send work item instances to people in multiple roles simultaneously
  • Each person in a role can approve or reject the work item instances sent to them
  • If one person rejects the instance, an early release can occur by defining a termination condition in its properties and the original instance can then leave the multi-instance subprocess
  • If a rejection occurs, all of the other copies can automatically be removed from the other role queues 

Antonis Antoniou has written an excellent blog on the PCS multi-instance subprocess.  This expands the scope of what he wrote a little to include how to assign the instances spawned to people in different roles, and shows how to cause an early release occur when a one person rejects their copy of the instance.                                                                                                                                                                                                                                               

 

Shown below is a process that illustrates this pattern (in the PCS application export file this is the “Approval Using MultiInstance Subprocess” process).  If any of the three approvers performing the “Accounting Approval”, “Auditor Approval” or “IT Manager Approval” reject their copy of the instance, the instance will be rejected and immediately leave the multi-instance subprocess.                                                                                                                                                          

Multi-Instance Subprocess with Three Assigned Activities

To create this, first create a process that starts with a form in PCS.  In this example, the start event’s form only has 3 fields and looks like this.

Process Start Event's Form with Three Fields

Next, from the System activities in the palette, add a Subprocess activity to the process. 

Add the Subprocess Activity to the Process

As shown above, define its properties to have a “Repetition Cycle” of “Generate multiple instances”, and select “In Parallel” so that they all are created at one time.  In this example, people in three different roles will be assigned copies of the instance so select the “Condition” radio button, and click the button to the right of the “How many instances do you want to create?” field and type the number 3.  We will come back later to the checkbox and field in the lower right corner to enable this activity’s early release functionality.                                                                                                                                                                    

 

Add the 5 Approve and Submit Human activities as shown below.  Assign the form that was created to each of them.  Add the two exclusive gateways shown below into the process.  The “Assign” exclusive gateway’s purpose is to send the copy of the instance to only one of the three different Approve Human activities based on the multi-instance subprocess’s predefined “loopCounter” variable.  The first copy will be sent to the “Auditor Approval” activity, the second copy will be sent to the “IT Manager Approval” activity, and the third copy will be sent to the “Accounting Approval” activity.                                                           

Multi-instance Subprocess with Activities Added

Recall that the number “3” was entered previously in the multi-instance activity’s property panel.  This means at runtime, three copies are created simultaneously with the predefined loopCounter automatically set to 1, 2 and 3 respectively.  The logic in the conditional sequence flow going to the “Auditor Approval” activity is “loopCounter==1”.  This can either be typed in manually, or to be able to select “loopCounter” check the “Show predefined variables” checkbox as shown below.                                                                                                                                                                                                                   

Logic in the Conditional Sequence Flows using the "loopcounter" Predefined Variable

Similarly, set the logic in the conditional sequence flow going to the “IT Manager Approval” activity to “loopCounter==2”.  The unconditional default sequence flow in this example goes to the “Accounting Approval” activity.                                                                                                                                                          

 

Rather than using the default role modeled in the process, assign each of these activities to their respective roles by selecting one of the Approval activities inside the subprocess, open its “Properties”, and select the “Edit” button beside the “Assignees” field.                                                                                             

Setting the Assignees in Each Activity

Select “Names and Expressions” from the “Build a list of participants …” dropdown.  Click the + button to add a role to be assigned to the activity.  In the example below, it is assigned to people in the application role named “Vendor Management.IT Manager”.                                                                                         

Assign the Role to the Activity

Do the same thing for the “Accounting Approval” and “Auditor Approval” activities, assigning them to different application roles or LDAP groups that exist.          

 

So that there is an early release if one of the approvers rejects their task, select the multi-instance subprocess activity in the process, and open its properties panel.  Check the “Define a condition that terminates execution of subprocess instances” checkbox, and define the logic that will enable this early release by clicking the “Edit Expression” button shown below.                                                                                                                                                                             

Early Release Termination Logic

Adding the expression is a little tricky because there are two output string variables to select from that have the same name.  As shown below, use the “taskOutput” string data object under the process (“ApprovalUsing MultiInstanceSubprocess” in this case) and not the copy’s output data object (under “Subprocess”).                                                                                                                                                                                                                                     

Adding the Early Release Termination Logic

Because a copy of the original work item instance is being used to populate the three copies, fix this by changing the data associations in each of the three Approval activities.  Select each one of the activities, select “Data Associations”, and change each one’s “Input” data association.  As shown below, on the left note that the object under the “Subprocess” was automatically used for the initial input data association mapping.  Remove this and change it to instead use the process’s data object (“multiIntanceFormDataObject” in this case).  Similarly, on the right side set the title of this copy of the instance task by expanding “execData” on the right and dragging “title” in from the right.   For this activity, note that the title is set to: 

    “Acounting Approval for “ + loopCounter

Assign the Activity Input Data Associations

As shown below, click the “Output” tab.  For each one of the three activities remove the automatically mapped Subprocess data objects, and replace them with the process’s data objects “taskOutput” and “muiltiInstanceFormDataObject” as shown below.

Assign the Output Data Associations

Ensure these data association mapping changes have been made to the other two Approval activities in the process.  The final exclusive gateway and the two Human Submit activities shown below are simply there to help determine if the early release works correctly.  The conditional sequence flow going to the “Rejected by Multi” Submit Human activity has the logic:

     taskOutput==”REJECT”

Exclusive Gateway's Conditional Sequence Flow Logic

Although I would be the first to admit that the BPMN complex gateway is missed in PCS, and that this approach takes a bit of work to accomplish, the complex gateway’s early release functionality can be achieved using the process modeling pattern described here. 

Reference:

1. “Multi-Instance Subprocess in Oracle Process Cloud Service” by Antonis Antoniou – http://antonis-antoniou.blogspot.com/2017/07/multi-instance-subprocess-…

2. “Dynamically Assigning an Oracle PCS Task to an Application Role” by Dan Atwood – https://www.avioconsulting.com/blog/dynamically-assigning-oracle-pcs-tas…