Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 9 Using Sub-Processes and Process Interfaces : Using Dynamic Sub-Processes

Using Dynamic Sub-Processes
Dynamic sub-processes are used when a process (which can be either a business process or a pageflow process) calls one of several sub-processes at runtime, but it is not known at design time which of these sub-processes will be called. The exact sub-process to be called on any given occasion is chosen at runtime, depending on the process data. For example, a corporate HR Department’s recruitment process might need to call different sub-processes for determining a candidate’s eligibility for employment depending on the country where the candidate is recruited.
In order for the main process to be able to accommodate any of the sub-processes that might be called, the sub-processes must all take and return a common set of data, which is known at design-time. This common data is specified by a process interface on which all the sub-processes are based. A Reusable Sub-Process task in the main process then specifies a call to the process interface instead of naming an individual sub-process.
Creating Dynamic Sub-Processes
To create a dynamic sub-process:
1.
2.
3.
a.
b.
4.
For a sub-process implementation which resides in an external sub-process library., you could use a script something like the script shown in the following illustration:
5.
For example:
Automatically Passing Different Data To and From Sub-Process Instances
If the Reusable Sub-Process task is multi-instance (or loop) it is possible to automatically pass different data to and from each separate sub-process instance.
Inputting Different Data To Each Sub-Process Instance
To input different data to each sub-process instance:
1.
2.
appointmentTypeArray.set(0, "X-Ray");
appointmentTypeArray.set(1, "PlasterDept");
appointmentTypeArray.set(2, "Physio");
3.
Returning Different Data From Each Sub-Process Instance
To return different data from each sub-process instance:
1.
2.
At runtime the array field will be populated with the return data from each sub-process instance. The list element index will correspond to the activity loop index from which the sub-process instance was invoked.
For example, if the sub-process returned an integer parameter "ReturnParam" with value "X-OK" when passed "X-Ray", "PL-OK" when passed "PlasterDept" and "PH-OK" when passed "Physio", and you mapped this to an array data field "ReturnArrayField", then:
The way that this data is passed behaves in the same way for multi-instance statically defined sub-process tasks (tasks that reference an actual sub-process at design time).
Controlling the Flow in Dynamic Sub-Processes
The flow of processing within dynamic sub-processes can be controlled using the facilities described in Chapter 6, Controlling Flow. In particular you can specify whether mutiple instances of the sub-processes should be performed sequentially or in parallel by using the Ordering and Flow Condition fields of the Reusable Sub-Process task. See Using Loops for more details.
You can also add additional instances to the loop while the sub-process is running, using a script on a parallel procesing path. For details, see Adding Additional Instances to a Multi-Instance Loop Task Whilst the Task is in Progress.
 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved