Skip Headers

Oracle Workflow API Reference
Release 2.6.3.5

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

CreateProcess

PL/SQL Syntax

procedure CreateProcess

    (itemtype in varchar2,
itemkey in varchar2,
process in varchar2 default '',
user_key in varchar2 default null,
owner_role in varchar2 default null);

Java Syntax

public static boolean createProcess

    (WFContext wCtx,
String itemType,
String itemKey,
String process)

Description

Creates a new runtime process for an application item.

For example, a Requisition item type may have a Requisition Approval Process as a top level process. When a particular requisition is created, an application calls CreateProcess to set up the information needed to start the defined process.

Arguments (input)

wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
itemtype A valid item type. Item types are defined in the Workflow Builder.
itemkey A string derived usually 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 new process and must be passed to all subsequent API calls for that process.

Note: The item key for a process instance can only contain single-byte characters. It cannot contain a multibyte value.

Note: You can pass #SYNCH as the itemkey to create a forced synchronous process. See: Synchronous, Asynchronous, and Forced Synchronous Processes.

process An optional argument that allows the selection of a particular process for that item. Provide the process internal name. If process is null, the item type's selector function is used to determine the top level process to run. If you do not specify a selector function and this argument is null, an error will be raised.
user_key A user-friendly key to assign to the item identified by the specified item type and item key. This argument is optional.
owner_role A valid role to set as the owner of the item. This argument is optional.

Caution: Although you can make a call to CreateProcess( ) and StartProcess( ) from a database 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.

Attention: The Workflow Engine always issues a savepoint before executing each activity in a process so that it can rollback to the previous activity in case an error occurs. For environments such as database triggers or distributed transactions that do not allow savepoints, the Workflow Engine automatically traps "Savepoint not allowed" errors and defers the execution of the activity. If you initiate a workflow process from a database trigger, the Workflow Engine immediately defers the initial start activities to a background engine, so that they are no longer executing from a database trigger.

Example

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

// create an item
if (WFEngineAPI.createProcess(ctx, iType, iKey, pr))
System.out.println("Created Item");
else
{
System.out.println("createProcess failed");
WFEngineAPI.showError(ctx);
}


         Previous  Next          Contents  Index  Glossary



Oracle Logo
Copyright © 2003, 2004, Oracle. All rights reserved.