Oracle Workflow Guide
Release 2.6.2
Part Number A95265-03 |
|
CompleteActivity
PL/SQL Syntax
procedure CompleteActivity
(itemtype in varchar2,
itemkey in varchar2,
activity in varchar2,
result_code in varchar2);
Description
Notifies the Workflow Engine that the specified activity has been completed for a particular item. This procedure can be called for the following situations:
- To indicate a completed activity with an optional result--This signals the Workflow Engine that an asynchronous activity has been completed. This procedure requires that the activity currently has a status of 'Notified'. An optional activity completion result can also be passed. The result can determine what transition the process takes next.
- To create and start an item--You can call CompleteActivity() for a 'Start' activity to implicitly create and start a new item. 'Start' activities are designated as the beginning of a process in the Workflow Builder. The item type and key specified in this call must be passed to all subsequent calls that operate on this item.
- Use CompleteActivity() if you cannot use CreateProcess() and StartProcess() to start your process. For example, call CompleteActivity() if you need to start a process with an activity node that is mid-stream in a process thread and not at the beginning of a process thread. The activity node you specify as the beginning of the process must be set to 'Start' in the Node tab of its property page or else an error will be raised.
Note: Starting a process using CompleteActivity() differs from starting a process using CreateProcess() and StartProcess() in these ways:
- The 'Start' activity called with CompleteActivity() may or may not have incoming transitions. StartProcess() executes only 'Start' activities that do not have any incoming transitions.
- CompleteActivity() only completes the single 'Start' activity with which it is called. Other 'Start' activities in the process are not completed. StartProcess(), however, executes every activity in the process that is marked as a 'Start' activity and does not have any incoming transitions.
- CompleteActivity() does not execute the activity with which it is called; it simply marks the activity as complete. StartProcess() does execute the 'Start' activities with which it starts a process.
- When you use CompleteActivity() to start a new process, the item type of the activity being completed must either have a selector function defined to choose a root process, or have exactly one runnable process with the activity being completed marked as a 'Start' activity. You cannot explicitly specify a root process as you can with StartProcess().
Arguments (input)
itemtype |
A valid item type.
|
itemkey |
A string generated from the application object's primary key. The string uniquely identifies the item within an item type. The item type and key together identify the process.
|
activity |
The name of the activity node that is completed. Provide the activity node's label name. If the activity node label name does not uniquely identify the subprocess you can precede the label name with the internal name of its parent process. For example, <parent_process_internal_name>:<label_name>. This activity node must be marked as a 'Start' activity.
|
result_code |
An optional activity completion result. Possible values are determined by the process activity's Result Type, or one of the engine standard results. See: AbortProcess.
|
Example 1
/*Complete the 'ENTER ORDER' activity for the 'ORDER' item type. The 'ENTER ORDER' activity allows creation of new items since it is the start of a workflow, so the item is created by this call as well.*/
wf_engine.CompleteActivity('ORDER', to_char(order.order_id),
'ENTER_ORDER', NULL);
Example 2
/*Complete the 'LEGAL REVIEW' activity with status 'APPROVED'. The item must already exist.*/
wf_engine.CompleteActivity('ORDER', '1003', 'LEGAL_REVIEW',
'APPROVED');
Example 3
/*Complete the BLOCK activity which is used in multiple subprocesses in parallel splits.*/
wf_engine.CompleteActivity('ORDER', '1003', 'ORDER_PROCESS:BLOCK-3',
'null');
|
Copyright © 1996, 2002 Oracle Corporation.
All Rights Reserved.