Previous  Next          Contents  Index  Glossary  Library

CreateProcess

Syntax

procedure CreateProcess

    (itemtype in varchar2,
     itemkey in varchar2,
     process in varchar2 default '');

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)

itemtypeA valid item type. Item types are defined in the Workflow Builder.
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 new process and must be passed to all subsequent API calls for that process.
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. This argument defaults to null.

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.

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
					WF_ENGINE.threshold := -1;
					WF_ENGINE.CreateProcess(...);
					WF_ENGINE.StartProcess(...);
				end


         Previous  Next          Contents  Index  Glossary  Library