Using Block Activity in Oracle Workflow

The Block activity lets you pause a process until some external program or manual step completes and makes a call to the CompleteActivity Workflow Engine API. Use the Block activity to delay a process until some condition is met, such as the completion of a concurrent program.
Make sure your program issues a CompleteActivity call when it completes to resume the process at the Block activity.

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.

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.

1

Call the CompleteActivity once  the external activity get complted.

The following code could be used for it.

begin
wf_engine.CompleteActivity(itemtype=>’TEST’
                           ,itemkey=>’16’
                           ,activity=>’TEST:BLOCK’
                           ,result=>WF_ENGINE.eng_null);
                           commit;
end;

Note : Remember to Commit after the call to CompleteActivity.

‘TEST:BLOCK’ is the label of the block

3

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.

/*Complete the 'LEGAL REVIEW' activity with status 'APPROVED'. The item must already exist.*/

wf_engine.CompleteActivity('ORDER', '1003', 'LEGAL_REVIEW',
                 'APPROVED');

/*Complete the BLOCK activity which is used in multiple subprocesses in parallel splits.*/

wf_engine.CompleteActivity('ORDER', '1003', 'ORDER_PROCESS:BLOCK-3',
                 'null'); 
2

Note : Do not try to re run the pl/sql block for the smae workflow item key. It might raise the following error.

Error report:
ORA-20002: 3133: Activity instance ‘TEST:BLOCK’ is not a notified activity for item ‘TEST/8’.
ORA-06512: at “APPS.WF_ENGINE”, line 5702
ORA-06512: at line 2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s