Skip Headers

Oracle Workflow API Reference
Release 2.6.3

Part Number B10286-02
Previous Next       Contents Index Glossary
         Previous  Next          Contents  Index  Glossary

StartProcess

PL/SQL Syntax

procedure StartProcess

(itemtype in varchar2,
itemkey in varchar2);

Java Syntax

public static boolean startProcess

(WFContext wCtx,
String itemType,
String itemKey)

Description

Begins execution of the specified process. The engine locates the activity marked as START and then executes it. CreateProcess( ) must first be called to define the itemtype and itemkey before calling StartProcess( ).

Arguments (input)

wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
itemtype A valid item type.
itemkey A string derived 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. See: CreateProcess.
Caution: Although you can make a call to CreateProcess( ) and StartProcess( ) from a trigger to initiate a workflow process, you should avoid doing so in certain circumstances. For example, if a database entity has headers, lines and details, and you initiate a workflow process from an AFTER INSERT trigger at the header-level of that entity, your workflow process may fail because some subsequent activity in the process may require information from the entity's lines or details level that is not yet populated.
Caution: The Workflow Engine always issues a savepoint before executing each activity so that it can rollback to the previous activity in case an error occurs. Because of this feature, you should avoid initiating a workflow process from a database trigger because savepoints and rollbacks are not allowed in a database trigger.
If you must initiate a workflow process from a database trigger, you must immediately defer the initial start activities to a background engine, so that they are no longer executing from a database trigger. To accomplish this:
or
begin
save_threshold := WF_ENGINE.threshold;
WF_ENGINE.threshold := -1;
WF_ENGINE.CreateProcess(...);
WF_ENGINE.StartProcess(...);
--Always reset threshold or all activities in this
--session will be deferred.
WF_ENGINE.threshold := save_threshold;
end
(This method has the same effect as the previous method, but is more secure as the initial start activities are always deferred even if the activities' costs change.
Note: You can pass #SYNCH as the itemkey to create a forced synchronous process. See: Synchronous, Asynchronous, and Forced Synchronous Processes.
Note: The item key for a process instance can only contain single-byte characters. It cannot contain a multibyte value.

Example

The following code excerpt shows an example of how to call startProcess() in a Java program. The example code is from the WFTest.java program.

// start a process
if (WFEngineAPI.startProcess(ctx, iType, iKey))
System.out.println("Process Started successfully");
else
{
System.out.println("launch failed");
WFEngineAPI.showError(ctx);
}

         Previous  Next          Contents  Index  Glossary


Oracle Logo
Copyright © 2003 Oracle Corporation.

All rights reserved.