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 item type and item key before calling StartProcess().

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:

Note: To begin execution of several instances of the same workflow process at once, call WF_ENGINE_BULK.StartProcess instead. See: WF_ENGINE_BULK.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.

Note: You can pass #SYNCH as the item key 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.

Sample Code

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);
}