Skip Headers

Oracle Workflow API Reference
Release 12.1
Part Number E12904-04
Go to Table of Contents
Contents
Go to previous page
Previous
Go to next page
Next

Workflow Engine APIs

This chapter describes the APIs for the Workflow Engine. The APIs consist of views and PL/SQL and Java functions and procedures that you can use to access the Workflow Engine, the Workflow Monitor, and workflow data.

This chapter covers the following topics:

Overview of the Workflow Engine

The Workflow Engine manages all automated aspects of a workflow process for each item. The engine is implemented in server-side PL/SQL and is activated whenever a call to a workflow procedure or function is made. Since the engine is embedded inside the Oracle Database, if the Workflow server goes down for any reason, the Oracle Database is able to manage the recovery and transactional integrity of any workflow transactions that were running at the time of the failure.

Additionally, Workflow engines can be set up as background tasks to perform activities that are too costly to execute in real time.

The Workflow Engine performs the following services for a client application:

The state of a workflow item is defined by the various states of all activities that are part of the process for that item. The engine changes activity states in response to an API call to update the activity. The API calls that update activity states are:

Based on the result of a previous activity, the engine attempts to execute the next activity directly. An activity may have the following status:

Important: The Workflow Engine traps errors produced by function activities by setting a savepoint before each function activity. If an activity produces an unhandled exception, the engine performs a rollback to the savepoint, and sets the activity to the ERROR status. For this reason, you should never commit within the PL/SQL procedure of a function activity. The Workflow Engine never issues a commit as it is the responsibility of the calling application to commit.

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 to the background engine.

Oracle Workflow components that continue workflow processing asynchronously, such as background engines and the Notification System, do issue commits when appropriate on behalf of the calling application.

Note: The Oracle Database supports autonomous transactions. By embedding the pragma AUTONOMOUS_TRANSACTION in your procedure, you can perform commits and rollbacks independently of the main transaction. Oracle treats this as a separate session; as such, you will not have access to any database changes that were made in the main session but are not yet committed. Consequently, you are restricted from updating workflow-specific data in an autonomous transaction; for instance, you cannot set item attributes. You cannot access this data because the item itself has not yet been committed, and because you may have lock contentions with the main session.

Oracle Workflow will not support autonomous commits in any procedure it calls directly. If you need to perform commits, then embed your SQL in a subprocedure and declare it as an autonomous block. This subprocedure must be capable of being rerun. Additionally, note that Oracle Workflow handles errors by rolling back the entire procedure and setting its status to ERROR. Database updates performed by autonomous commits cannot be rolled back, so you will need to write your own compensatory logic for error handling. For more information, see: Autonomous Transactions, Oracle Database Concepts.

Oracle Workflow Java Interface

The Oracle Workflow Java interface provides a means for any Java program to integrate with Oracle Workflow. The Oracle Workflow Engine and Notification APIs are accessible through public server PL/SQL packages and published views. The Oracle Workflow Java interface exposes those APIs as Java methods that can be called by any Java program to communicate with Oracle Workflow. The Java methods directly reference the WF_ENGINE and WF_NOTIFICATION PL/SQL package procedures and views and communicate with the Oracle Workflow database through JDBC.

The methods are defined within the WFEngineAPI class and the WFNotificationAPI class, in the Java package 'oracle.apps.fnd.wf.engine'. If a Workflow Engine or notification API has a corresponding Java method, its Java method syntax is displayed immediately after its PL/SQL syntax in the documentation. See: Workflow Engine APIs and Notification APIs.

The WFFunctionAPI class and the WFAttribute class also contain methods that can be called to communicate with Oracle Workflow. These classes are defined in the Java package 'oracle.apps.fnd.wf'. See: Workflow Function APIs and Workflow Attribute APIs.

Java programs that integrate with Oracle Workflow should include the following import statements to provide access to classes required by Oracle Workflow:

import java.io.*; 
import java.sql.*; 
import java.math.BigDecimal; 

import oracle.sql.*; 
import oracle.jdbc.*;

import oracle.apps.fnd.common.*; 
import oracle.apps.fnd.wf.engine.*; 
import oracle.apps.fnd.wf.*; 

Oracle Workflow Context

Each Oracle Workflow Java method that accesses the database requires an input of a WFContext object. The WFContext object consists of database connectivity information which you instantiate and resource context information that the WFContext class instantiates. To call one of these Workflow Java APIs in your Java program, you must first instantiate a database variable of class WFDB with your database username, password and alias. You can also optionally supply a JDBC string. Then you must instantiate the WFContext object with the database variable. You can retrieve the system property CHARSET to specify the character set for the database session. The following code excerpt shows an example of how to instantiate these objects.

WFDB myDB;
WFContext ctx;

myDB = new WFDB(m_user, m_pwd, m_jdbcStr, m_conStr);
m_charSet = System.getProperty("CHARSET");
if (m_charSet == null) { // cannot be null
  m_charSet = "UTF8";

}

try {
  ctx = new WFContext(myDB, m_charSet); 
  // m_charSet is 'UTF8' by default

  if (ctx.getDB().getConnection() == null) {
    // connection failed
    return;
  }

  // We now have a connection to the database.
}

catch (Exception e) {
// exit Message for this exception
}

If you have already established a JDBC connection, you can simply set that connection into the WFContext object, as shown in the following example:

WFContext ctx;

m_charSet = System.getProperty("CHARSET");
if (m_charSet == null) { // cannot be null
  m_charSet = "UTF8";
}

ctx = new WFContext(m_charSet); 
// m_charSet is 'UTF8' by default

ctx.setJDBCConnection(m_conn);  
// m_conn is a pre-established JDBC connection

The Oracle Workflow Java APIs can be used safely in a thread, with certain restrictions:

There is no synchronized code inside the Oracle Workflow Java APIs, but there are no shared resources, either.

There is also no connection pooling in the Oracle Workflow Java APIs. For Oracle E-Business Suite, connection pooling is implemented at the AOL/J level; after you get the JDBC connection, you use the WFContext.setJDBCConnection() API to set the connection. This approach lets you manage your JDBC connection outside of the Oracle Workflow APIs.

Sample Java Program

Oracle Workflow provides an example Java program that illustrates how to call most of the Workflow Engine and Notification Java APIs. The Java program is named WFTest. It calls the various Java APIs to launch the WFDEMO process, set and get attributes, and suspend, resume, and abort the process, as well as the APIs to send a notification, set and get notification attributes, and delegate and transfer the notification. Before running the WFTest Java program, make sure you define CLASSPATH and LD_LIBRARY_PATH for the Oracle JDBC implementation and a supported version of Oracle. For example, on UNIX, use the following commands:

setenv CLASSPATH 
<Workflow_JAR_file_directory>/wfapi.jar:${ORACLE_HOME}/jdbc/lib/classes111.zip

setenv LD_LIBRARY_PATH ${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}

Note: The Workflow JAR files are located in the <ORACLE_HOME>/wf/java/oracle/apps/fnd/wf/jar/ directory.

To initiate the WFTest program, run Java against oracle.apps.fnd.wf.WFTest. For example, on UNIX, enter the following statement on the command line:

$java oracle.apps.fnd.wf.WFTest

The source file for this program is also included in your Oracle Workflow installation so that you can view the sample code. The source file is named WFTest.java and is located in the <ORACLE_HOME>/wf/java/oracle/apps/fnd/wf/ directory.

Additional Workflow Engine Features

In addition to managing a process, the Workflow Engine also supports the following features:

Completion Processing

Engine processing is triggered whenever a process activity completes and calls the Workflow Engine API. The engine then attempts to execute (or mark for deferred execution) all activities that are dependent on the completed activity.

Note: A process as a whole can complete but still contain activities that were visited but not yet completed. For example, a completed process may contain a standard Wait activity that is not complete because the designated length of time to wait has not yet elapsed. When the process as a whole completes, the Workflow Engine marks these incomplete activities as having a status of COMPLETE and a result of #FORCE. This distinction is important when you review your process status through the Workflow Monitor.

Deferred Processing

The engine has a deferred processing feature that allows long-running tasks to be handled by background engines instead of in real time. Deferring the execution of activity functions to background engines allows the Workflow Engine to move forward to process other activities that are currently active. The engine can be set up to operate anywhere on a continuum between processing all eligible work immediately, to processing nothing and marking all transitions as deferred.

Each activity has a user-defined processing cost. You can set this cost to be small if the activity merely sets an item attribute, or you may set it to be very high if the activity performs a resource-intensive operation. If the result of a completed activity triggers the execution of a costly function, you might want to defer the execution of that costly function to a background engine.

The Workflow Engine integrates with Oracle Advanced Queues to carry out deferred processing. If a function activity has a cost that exceeds the main threshold cost, the Workflow Engine marks that activity with a status of 'DEFERRED' in the workflow status tables and enqueues the deferred activity to a special queue for deferred activities. A special queue processor called the background engine checks and processes the activities in the 'deferred' queue. The order in which the deferred activities are processed are based on the first in, first out ordering of an activity's enqueue time. At least one background engine must be set up to run at all times. Some sites may have multiple background engines operating at different thresholds or item type specifications, to avoid tying up all background processing with long-running operations.

See: Setting Up Background Engines, Oracle Workflow Administrator's Guide, Activity Cost, Oracle Workflow Developer's Guide, and Deferring Activities, Oracle Workflow Administrator's Guide.

Error Processing

Errors that occur during workflow execution cannot be directly returned to the caller, since the caller generally does not know how to respond to the error (in fact, the caller may be a background engine with no human operator). You can use Oracle Workflow Builder to define the processing you want to occur in case of an error. Use Oracle Workflow Builder to assign the Default Error Process associated with the System:Error item type or create your own custom error process. See: Error Handling for Workflow Processes, Oracle Workflow Developer's Guide.

The error process can include branches based on error codes, send notifications, and attempt to deal with the error using automated rules for resetting, retrying, or skipping the failed activity. Once you define an error process, you can associate it with any activity. The error process is then initiated whenever an error occurs for that activity. See: To Define Optional Activity Details, Oracle Workflow Developer's Guide.

The Workflow Engine traps errors produced by function activities by setting a savepoint before each function activity. If an activity produces an unhandled exception, the engine performs a rollback to the savepoint, and sets the activity to the ERROR status.

Note: For this reason, you should never commit within the PL/SQL procedure of a function activity. The Workflow Engine never issues a commit as it is the responsibility of the calling application to commit.

The Workflow Engine then attempts to locate an error process to run by starting with the activity which caused the error, and then checking each parent process activity until an associated error process is located.

Looping

Looping occurs when the completion of an activity causes a transition to another activity that has already been completed. The first activity that gets detected as a revisited activity is also called a loop point or pivot activity. The Workflow Engine can handle a revisited activity in one of three ways:

Every activity has an On Revisit poplist field in its Oracle Workflow Builder Details property page. The On Revisit poplist lets you specify the behavior of the Workflow Engine when it revisits the activity in a workflow process. You can set the field to Ignore, Reset, or Loop.

Setting On Revisit to Ignore is useful for implementing activities that should only run once, even though they can be transitioned to from multiple sources. For example, this mode allows you to implement a "logical OR" type of activity which is transitioned to multiple times, but completes after the first transition only.

Setting On Revisit to Reset for an activity is useful when you want to reexecute activities in a loop, but you want to first reset the status of the activities in the loop. Reset causes the Workflow Engine to do the following:

Cancelling an activity is similar to executing the activity, except that the activity is executed in "CANCEL" mode rather than "RUN" mode. You can include compensatory logic in "CANCEL" mode that reverses any operation performed earlier in "RUN" mode.

If you set On Revisit to Reset for the pivot activity of a loop that includes an FYI notification activity, the Workflow Engine cancels the previous notification before reexecuting the loop and sending a new notification to the current performer of the notification activity.

Setting On Revisit to Loop for an activity is useful when you want to simply reexecute activities in a loop without resetting the status of the activities in the loop. Loop causes the Workflow Engine to reexecute the activity in "RUN" mode without executing any "CANCEL" mode logic for the activity.

If you set On Revisit to Loop for the pivot activity of a loop that includes an FYI notification activity, previous notifications remain open when the Workflow Engine reexecutes the loop and sends a new notification to the current performer of the notification activity.

Version / Effective Date

Certain workflow objects in a process definition are marked with a version number so that more than one version of the object can be in use at any one time. These objects are:

If you edit and save any of the above objects in Oracle Workflow Builder to the database, Oracle Workflow automatically creates a new version of that object or the owning object by incrementing the version number by one. If you save edits to any of the above objects to an existing file, then the original objects are overwritten. If you have a process instance that is still running and you upgrade the underlying workflow definition in your Workflow server, the process instance continues to run using the version of the workflow object definitions with which it was originally initiated.

An effective date controls which version of a definition the engine uses when executing a process. When you edit a process, you can save it with an immediate or future effective date. Any new process instance that is initiated always uses the version that is specified to be effective at that point in time. See: Opening and Saving Item Types, Oracle Workflow Developer's Guide.

Note that Oracle Workflow does not maintain versions for other workflow objects. Any modifications that you save to the following objects overwrites the existing definition of the object:

Item Type Attributes

A set of item type attributes is defined at both design-time and runtime for each item. These attributes provide information to the function and notification activities used in the processes associated with the item type.

When you define item type attributes at runtime, you can add either individual attributes or arrays containing several attributes of the same type, using the appropriate Workflow Engine APIs. Similarly, you can set the values of existing attributes either individually or in arrays containing several attributes of the same type.

Use the array APIs whenever you need to add or set the values of large numbers of item type attributes at once. These APIs improve performance by using the bulk binding feature in the Oracle Database to reduce the number of database operations. See: AddItemAttributeArray and SetItemAttributeArray.

Note: These array APIs handle arrays that are composed of multiple item type attributes grouped together by type. Oracle Workflow does not support individual item type attributes that consist of arrays themselves.

Post-Notification Functions

You can associate a post-notification function with a notification activity. The Workflow Engine executes the post-notification function in response to an update of the notification's state after the notification is delivered. For example, you can specify a post-notification function that executes when the notification recipient forwards or transfers the notification. The post-notification function could perform back-end logic to either validate the legitimacy of the forward or transfer or execute some other supporting logic.

The post-notification function should be a PL/SQL procedure written to the same API standards required for function activities. See: Standard API for PL/SQL Procedures Called by Function Activities, Oracle Workflow Developer's Guide.

When you specify a post-notification function, the Workflow Engine first sets the context information to use with the function through the following global engine variables. In some cases the values of the variables differ depending on the mode in which the post-notification function is called.

You can reference these global engine variables in your PL/SQL function.

Note: For RUN mode and TIMEOUT mode, only the WF_ENGINE.context_nid and WF_ENGINE.context_user variables are set.

Note: The WF_ENGINE.context_text variable from earlier versions of Oracle Workflow is replaced by the WF_ENGINE.context_user and WF_ENGINE.context_new_role variables. The current version of Oracle Workflow still recognizes the WF_ENGINE.context_text variable for backward compatibility, but moving forward, you should only use the new WF_ENGINE.context_user and WF_ENGINE.context_new_role variables where appropriate.

Then when the notification's state changes, a notification callback function executes the post-notification function in the mode that matches the notification's state: RESPOND, FORWARD, TRANSFER, QUESTION, or ANSWER.

When a recipient responds, the Workflow Engine initially runs the post-notification function in VALIDATE mode which allows you to validate the response values before accepting the response. Then the Workflow Engine runs the post-notification function in RESPOND mode to record the response. Finally, when the Notification System completes execution of the post-notification function in RESPOND mode, the Workflow Engine automatically runs the post-notification function again in RUN mode. In this mode, the post-notification function can perform additional processing such as vote tallying.

If a notification activity times out, the Workflow Engine runs the post-notification function for the activity in TIMEOUT mode. For a Voting activity, the TIMEOUT mode logic should identify how to tally the votes received up until the timeout.

If a notification activity is reset to be reexecuted as part of a loop, the Workflow Engine runs the post-notification function in CANCEL mode.

When the post-notification function completes, the Workflow Engine erases the global engine variables.

As a final step, if the post-notification function is run in TRANSFER mode and Expand Roles is not checked for the notification activity, the Workflow Engine sets the assigned user for the notification to the new role name specified.

Important: If the post-notification function returns ERROR:<errcode> as a result or raises an exception, the Workflow Engine aborts the operation. For example, if the post-notification function is executed in FORWARD mode and it raises an exception because the role being forwarded to is invalid, an error is displayed to the user and the Forward operation is not executed. The notification recipient is then prompted again to take some type of action.

See: Notification Model.

Synchronous, Asynchronous, and Forced Synchronous Processes

A workflow process can be either synchronous or asynchronous. A synchronous process is a process that can be executed without interruption from start to finish. The Workflow Engine executes a process synchronously when the process includes activities that can be completed immediately, such as function activities that are not deferred to the background engine. The Workflow Engine does not return control to the calling application that initiated the workflow until it completes the process. With a synchronous process, you can immediately check for process results that were written to item attributes or directly to the database. However, the user must wait for the process to complete.

An asynchronous process is a process that the Workflow Engine cannot complete immediately because it contains activities that interrupt the flow. Examples of activities that force an asynchronous process include deferred activities, notifications with responses, blocking activities, and wait activities. Rather than waiting indefinitely when it encounters one of these activities, the Workflow Engine sets the audit tables appropriately and returns control to the calling application. The workflow process is left in an unfinished state until it is started again. The process can be restarted by the Notification System, such as when a user responds to a notification; by the background engine, such as when a deferred activity is executed; or by the Business Event System, such as when an event message is dequeued from an inbound queue and sent to the workflow process. With an asynchronous process, the user does not have to wait for the process to complete to continue using the application. However, the results of the process are not available until the process is completed at a later time.

In addition to regular synchronous and asynchronous processes, the Workflow Engine also supports a special class of synchronous processes called forced synchronous processes. A forced synchronous process completes in a single SQL session from start to finish and never inserts into or updates any database tables. As a result, the execution speed of a forced synchronous process is significantly faster than a typical synchronous process. The process results are available immediately upon completion. However, no audit trail is recorded.

There may be cases when your application requires a forced synchronous process to generate a specific result quickly when recording an audit trail is not a concern. For example, several Oracle E-Business Suite products require Account Generator workflows to generate a meaningful flexfield code derived from a series of concatenated segments pulled from various tables. The Account Generator workflows are forced synchronous processes that compute and pass back completed flexfield codes to the calling applications instantaneously.

To create a forced synchronous process, you need to set the item key of your process to #SYNCH or to wf_engine.eng_synch, which returns the #SYNCH constant, when you call the necessary WF_ENGINE APIs. Since a forced synchronous process never writes to the database, using a non-unique item key such as #SYNCH is not an issue. Your process definition, however, must adhere to the following set of restrictions:

Important: If you encounter an error from a forced synchronous process, you should rerun the process with a unique item key in asynchronous mode and check the error stack using the Workflow Monitor or the script wfstat.sql. If the synchronous process completes successfully, the error you encountered in the forced synchronous process is probably due to a violation of one of the above listed restrictions. See: Wfstat.sql, Oracle Workflow Administrator's Guide.

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

See: Synchronous, Asynchronous, and Forced Synchronous Workflows, Oracle Workflow Administrator's Guide.

Business Events

Events from the Business Event System are represented within workflow processes as event activities. An event activity can either raise, send, or receive a business event.

A Raise event activity raises an event to the Event Manager, triggering any subscriptions to that event. The Workflow Engine calls the WF_EVENT.Raise API to raise the event. See: Raise.

A Send event activity sends an event directly to a Business Event System agent without raising the event to the Event Manager. The Workflow Engine calls the WF_EVENT.Send API to send the event. See: Send.

A Receive event activity receives an event from the Event Manager into a workflow process, which then continues the thread of execution from that activity. The Workflow Engine can receive an event into an activity in an existing process instance that is waiting for the event, using the correlation ID in the event message to match the event with the process to which it belongs. The Workflow Engine can also receive an event into a Receive event activity that is marked as a Start activity to launch a new workflow process. The WF_ENGINE.Event API is used to receive an event into a workflow process. See: Event.

See also: Managing Business Events, Oracle Workflow Developer's Guide and Event Activities, Oracle Workflow Developer's Guide.

Workflow Engine APIs

The Workflow Engine APIs can be called by an application program or a workflow function in the runtime phase to communicate with the engine and to change the status of each of the activities. These APIs are defined in a PL/SQL package called WF_ENGINE.

Many of these Workflow Engine APIs also have corresponding Java methods that you can call from any Java program to integrate with Oracle Workflow. The following list indicates whether the Workflow Engine APIs are available as PL/SQL functions/procedures, as Java methods, or both.

Important: Java is case-sensitive and all Java method names begin with a lower case letter to follow Java naming conventions.

Some Workflow Engine APIs use PL/SQL table composite datatypes defined in the WF_ENGINE package. The following table shows the column datatype definition for each PL/SQL table type.

PL/SQL Table Types in WF_ENGINE
PL/SQL Table Type Column Datatype Definition
NameTabTyp Wf_Item_Attribute_Values.NAME%TYPE
TextTabTyp Wf_Item_Attribute_Values.TEXT_VALUE%TYPE
NumTabTyp Wf_Item_Attribute_Values.NUMBER_VALUE%TYPE
DateTabTyp Wf_Item_Attribute_Values.DATE_VALUE%TYPE

Related Topics

Standard API for PL/SQL Procedures Called by Function Activities, Oracle Workflow Developer's Guide

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 instance 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.

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.

Important: 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.

Note: To create several instances of the same workflow process at once, call WF_ENGINE_BULK.CreateProcess instead. See: WF_ENGINE_BULK.CreateProcess.

Arguments (input)

Variable Description
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.

Sample Code

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
{
  Systm.out.println("createProcess failed");
  WFEngineAPI.showError(ctx);
}

SetItemUserKey

PL/SQL Syntax

procedure SetItemUserKey
  (itemtype in varchar2,
   itemkey in varchar2,
   userkey in varchar2);

Java Syntax

public static boolean setItemUserKey
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String userKey)

Description

Lets you set a user-friendly identifier for an item in a process, which is initially identified by an item type and item key. The user key is intended to be a user-friendly identifier to locate items in the Workflow Monitor and other user interface components of Oracle Workflow.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
itemtype or itemType A valid item type.
itemkey or itemKey A string generated 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 process. See: CreateProcess.
userkey or userKey The user key to assign to the item identified by the specified item type and item key.

GetItemUserKey

PL/SQL Syntax

function GetItemUserKey
  (itemtype in varchar2,
   itemkey in varchar2)
  return varchar2;

Java Syntax

public static String getItemUserKey
  (WFContext wCtx,
   String itemType,
   String itemKey)

Description

Returns the user-friendly key assigned to an item in a process, identified by an item type and item key. The user key is a user-friendly identifier to locate items in the Workflow Monitor and other user interface components of Oracle Workflow.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
itemtype or itemType A valid item type.
itemkey or itemKey A string generated 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 process. See: CreateProcess.

GetActivityLabel

PL/SQL Syntax

function GetActivityLabel
  (actid in number)
  return varchar2;

Description

Returns the instance label of an activity, given the internal activity instance ID. The label returned has the following format, which is suitable for passing to other Workflow Engine APIs, such as CompleteActivity and HandleError, that accept activity labels as arguments:

<process_name>:<instance_label> 

Arguments (input)

Variable Description
actid An activity instance ID.

SetItemOwner

PL/SQL Syntax

procedure SetItemOwner
  (itemtype in varchar2,
   itemkey in varchar2,
   owner in varchar2);

Java Syntax

public static boolean setItemOwner
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String owner)

Description

A procedure to set the owner of existing items. The owner must be a valid role. Typically, the role that initiates a transaction is assigned as the process owner, so that any participant in that role can find and view the status of that process instance in the Workflow Monitor.

Arguments (input)

Variable Description
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 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.
owner A valid role.

Sample Code

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

// set item owner
if (WFEngineAPI.setItemOwner(ctx, iType, iKey, owner))
  System.out.println("Set Item Owner: "+owner);
else
{
  System.out.println("Cannot set owner.");
  WFEngineAPI.showError(ctx);
}

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)

Variable Description
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

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

LaunchProcess

PL/SQL Syntax

procedure LaunchProcess
  (itemtype in varchar2,
   itemkey in varchar2,
   process in varchar2 default '',
   userkey in varchar2 default '',
   owner in varchar2 default '');

Java Syntax

public static boolean launchProcess
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String process,
   String userKey,
   String owner)

Description

Launches a specified process by creating the new runtime process and beginning its execution. This is a wrapper that combines CreateProcess and StartProcess.

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.

Important: 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.

Note: To create several instances of the same workflow process at once and begin execution of the processes at a specified start activity, call WF_ENGINE_BULK.FastForward instead. See: WF_ENGINE_BULK.FastForward.

Arguments (input)

Variable Description
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 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.

You can pass #SYNCH as the item key 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. This argument defaults to null.
userkey The user key to assign to the item identified by the specified item type and item key. If userkey is null, then no user key is assigned to the item instance.
owner A valid role designated as the owner of the item. If owner is null, then no owner is assigned to the process and only the workflow administrator role can monitor the process.

SuspendProcess

PL/SQL Syntax

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

Java Syntax

public static boolean suspendProcess
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String process)

Description

Suspends process execution so that no new transitions occur. Outstanding notifications can complete by calling CompleteActivity(), but the workflow does not transition to the next activity. Restart suspended processes by calling ResumeProcess().

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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. See: CreateProcess.
process An optional argument that allows the selection of a particular subprocess for that item. Provide the process activity's label name. If the process activity 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>

If this argument is null, the top level process for the item is suspended. This argument defaults to null.

Sample Code

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

// suspend, status should become SUSPEND
System.out.println("Suspend Process " + iType +"/"+ iKey +
    " ...");
if (WFEngineAPI.suspendProcess(ctx, iType, iKey, null))
  System.out.println("Seems to suspend successfully");
else
{
  System.out.println("suspend failed");
  WFEngineAPI.showError(ctx);
}

ResumeProcess

PL/SQL Syntax

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

Java Syntax

public static boolean resumeProcess
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String process)

Description

Returns a suspended process to normal execution status. Any activities that were transitioned to while the process was suspended are now executed.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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. See: CreateProcess.
process An optional argument that allows the selection of a particular subprocess for that item type. Provide the process activity's label name. If the process activity 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>

If this argument is null, the top level process for the item is resumed. This argument defaults to null.

Sample Code

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

// resume process and status should be ACTIVE
System.out.println("Resume Process " + iType +"/"+ iKey +
    " ...");
if (WFEngineAPI.resumeProcess(ctx, iType, iKey, null))
  System.out.println("Seems to resume successfully");
else
{
  System.out.println("resume failed");
  WFEngineAPI.showError(ctx);
}

AbortProcess

PL/SQL Syntax

procedure AbortProcess
  (itemtype in varchar2,
   itemkey in varchar2,
   process in varchar2 default '',
   result in varchar2 default wf_engine.eng_force,
   verify_lock in boolean default FALSE,
   cascade in boolean default FALSE);

Java Syntax

public static boolean abortProcess
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String process,
   String result,
   boolean verifyLock,
   boolean cascade)

Description

Aborts process execution and cancels outstanding notifications. The process status is considered COMPLETE, with a result specified by the result argument. Also, any outstanding notifications or subprocesses are set to a status of COMPLETE with a result of force, regardless of the result argument.

This API also raises the oracle.apps.wf.engine.abort event. Although Oracle Workflow does not include any predefined subscriptions to this event, you can optionally define your own subscriptions to this event if you want to perform custom processing when it occurs. See: Workflow Engine Events, Oracle Workflow Developer's Guide and To Create or Update an Event Subscription, Oracle Workflow Developer's Guide.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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. See: CreateProcess.
process An optional argument that allows the selection of a particular subprocess for that item type. Provide the process activity's label name. If the process activity 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> 

If this argument is null, the top level process for the item is aborted. This argument defaults to null.
result A status assigned to the aborted process. The result must be one of the values defined in the process Result Type, or one of the following standard engine values:
  • eng_exception
  • eng_timeout
  • eng_force
  • eng_mail
  • eng_null

This argument defaults to "eng_force".
verify_lock or verifyLock Specify TRUE if you want to lock the item before processing it, or FALSE if you do not want to lock the item. Locking the item controls concurrent execution contention. The default value is FALSE.
cascade Specify TRUE if you also want to abort all child processes associated with the process being aborted, or FALSE if you only want to abort the specified process and not its child processes. The default value is FALSE.

Sample Code

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

// abort process, should see status COMPLETE with result 
// code force
System.out.println("Abort Process ..." + iType + "/" + 
    iKey);
if (!WFEngineAPI.abortProcess(ctx, iType, iKey, pr, null))
{
  System.out.println("Seemed to have problem aborting...");
  WFEngineAPI.showError(ctx);
}

CreateForkProcess

PL/SQL Syntax

procedure CreateForkProcess
  (copy_itemtype in varchar2,
   copy_itemkey in varchar2,
   new_itemkey in varchar2,
   same_version in boolean default TRUE);

Description

Forks a runtime process by creating a new process that is a copy of the original. After calling CreateForkProcess(), you can call APIs such as SetItemOwner(), SetItemUserKey(), or the SetItemAttribute APIs to reset any item properties or modify any item attributes that you want for the new process. Then you must call StartForkProcess() to start the new process.

Use CreateForkProcess() when you need to change item specific attributes during the course of a process. For example, if an order cannot be met due to insufficient inventory stock, you can use CreateForkProcess() to fork a new transaction for the backorder quantity. Note that any approval notification will be copied. The result is as if two items were created for this transaction.

Caution: Do not call CreateForkProcess() and StartForkProcess() from within a parallel branch in a process. These APIs do not copy any branches parallel to their own branch that are not active.

Note: When you fork an item, Oracle Workflow automatically creates an item attribute called #FORKED_FROM for the new item and sets the attribute to the item key of the original item. This attribute provides an audit trail for the forked item.

Arguments (input)

Variable Description
copy_itemtype A valid item type for the original process to be copied. The new process will have the same item type.
copy_itemkey A string generated from the application object's primary key. The string uniquely identifies the item within an item type. The copy item type and key together identify the original process to be copied.
new_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 new item key together identify the new process.

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

same_version Specify TRUE or FALSE to indicate whether the new runtime process uses the same version as the original or the latest version. If you specify TRUE, CreateForkProcess() copies the item attributes and status of the original process to the new process. If you specify FALSE, CreateForkProcess() copies the item attributes of the original process to the new process but does not copy the status. Defaults to TRUE.

StartForkProcess

PL/SQL Syntax

procedure StartForkProcess
  (itemtype in varchar2,
   itemkey in varchar2);

Description

Begins execution of the new forked process that you specify. Before you call StartForkProcess(), you must first call CreateForkProcess() to create the new process. You can modify the item attributes of the new process before calling StartForkProcess().

If the new process uses the same version as the original, StartForkProcess() copies the status and history of each activity in the forked process, activity by activity. If the new process uses the latest version, then StartForkProcess() executes StartProcess().

If you call StartForkProcess() from within a process, any function activity in the process that had a status of 'Active' is updated to have a status of 'Notified'. You must call CompleteActivity() afterwards to continue the process.

StartForkProcess() automatically refreshes any notification attributes that are based on item attributes. Any open notifications in the original process are copied and sent again in the new process. Closed notifications are copied but not resent; their status remains remains 'Complete'.

Any Wait activities in the new process are activated at the same time as the original activities. For example, if a 24 hour Wait activity in the original process is due to be eligible in two hours, the new Wait activity is also eligible in two hours.

Caution: Do not call CreateForkProcess() and StartForkProcess() from within a parallel branch in a process. These APIs do not copy any branches parallel to their own branch that are not active.

Arguments (input)

Variable Description
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.

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

Background

PL/SQL Syntax

procedure Background
  (itemtype in varchar2 default '',
   minthreshold in number default null,
   maxthreshold in number default null,
   process_deferred in boolean default TRUE,
   process_timeout in boolean default TRUE,
   process_stuck in boolean default FALSE);

Description

Runs a background engine for processing deferred activities, timed out activities, and stuck processes using the parameters specified. The background engine executes all activities that satisfy the given arguments at the time that the background engine is invoked. This procedure does not remain running long term, so you must restart this procedure periodically. Any activities that are newly deferred or timed out or processes that become stuck after the current background engine starts are processed by the next background engine that is invoked. You can run a script called wfbkgchk.sql to get a list of the activities waiting to be processed by the next background engine run. See: Wfbkgchk.sql, Oracle Workflow Administrator's Guide.

You must not call Background() from within application code. If you want to call this procedure directly, you can run it from SQL*Plus. Otherwise, you can use the concurrent program version of this procedure and take advantage of the concurrent manager to schedule the background engine to run periodically. You can also use the Workflow Manager component of Oracle Applications Manager to submit the background engine concurrent program. See: To Schedule Background Engines, Oracle Workflow Administrator's Guide.

Arguments (input)

Variable Description
itemtype A valid item type. If the item type is null the background engine will run for all item types.
minthreshold Optional minimum cost threshold for an activity that this background engine processes, in hundredths of a second. There is no minimum cost threshold if this parameter is null.
maxthreshold Optional maximum cost threshold for an activity that this background engine processes in hundredths of a second. There is no maximum cost threshold if this parameter is null.
process_deferred Specify TRUE or FALSE to indicate whether to run deferred processes. Defaults to TRUE.
process_timeout Specify TRUE or FALSE to indicate whether to run timed out processes. Defaults to TRUE.
process_stuck Specify TRUE or FALSE to indicate whether to run stuck processes. Defaults to FALSE.

AddItemAttribute

PL/SQL Syntax

procedure AddItemAttr
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2,
   text_value in varchar2 default null,
   number_value in number default null, 
   date_value in date default null);

Java Syntax

public static boolean addItemAttr
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String aName)

public static boolean addItemAttrText
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String aName,
   String aValue)

public static boolean addItemAttrNumber
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String aName,
   BigDecimal numberVal)

public static boolean addItemAttrDate
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String aName,
   String aValue)

Description

Adds a new item type attribute variable to the process. Although most item type attributes are defined at design time, you can create new attributes at runtime for a specific process. You can optionally set a default text, number, or date value for a new item type attribute when the attribute is created.

If you are using Java, choose the correct method for your attribute type. To add an empty item type attribute, use addItemAttr(). When adding an item type attribute with a default value, use addItemAttrText() for all attribute types except number and date.

Note: If you need to add large numbers of item type attributes at once, use the AddItemAttributeArray APIs rather than the AddItemAttribute APIs for improved performance. See: AddItemAttributeArray.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java methods only. See: Oracle Workflow Context.
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. See: CreateProcess.
aname The internal name of the item type attribute.
text_value The default text value for the item type attribute. Required for the PL/SQL procedure only. Defaults to null.
number_value or numberVal The default number value for the item type attribute. Required for the PL/SQL procedure and addItemAttrNumber() Java method only. Defaults to null.
date_value The default date value for the item type attribute. Required for the PL/SQL procedure only. Defaults to null.
aValue The default value for the item type attribute. Required for the addItemAttrText() and addItemAttrDate() Java methods only.

Sample Code

The following example shows how API calls can be simplified by using AddItemAttr() to set the default value of a new item type attribute at the time of creation.

Using AddItemAttr() to create the new attribute and SetItemAttrText() to set the value of the attribute, the following calls are required:

AddItemAttr('ITYPE', 'IKEY', 'NEWCHAR_VAR');
SetItemAttrText('ITYPE', 'IKEY', 'NEWCHAR_VAR', 
                'new text values');

Using AddItemAttr() both to create the new attribute and to set its value, only the following call is required:

AddItemAttr('ITYPE', 'IKEY', 'NEWCHAR_VAR', 
            'new text values');

AddItemAttributeArray

PL/SQL Syntax

procedure AddItemAttrTextArray
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in Wf_Engine.NameTabTyp,
   avalue in Wf_Engine.TextTabTyp);

procedure AddItemAttrNumberArray
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in Wf_Engine.NameTabTyp,
   avalue in Wf_Engine.NumTabTyp);

procedure AddItemAttrDateArray
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in Wf_Engine.NameTabTyp,
   avalue in Wf_Engine.DateTabTyp);

Description

Adds an array of new item type attributes to the process. Although most item type attributes are defined at design time, you can create new attributes at runtime for a specific process. Use the AddItemAttributeArray APIs rather than the AddItemAttribute APIs for improved performance when you need to add large numbers of item type attributes at once.

Use the correct procedure for your attribute type. All attribute types except number and date use AddItemAttrTextArray.

Arguments (input)

Variable Description
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. See: CreateProcess.
aname An array of the internal names of the new item type attributes.
avalue An array of the values for the new item type attributes.

SetItemAttribute

PL/SQL Syntax

procedure SetItemAttrText
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2,
   avalue in varchar2);

procedure SetItemAttrNumber
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2,
   avalue in number);

procedure SetItemAttrDate
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2,
   avalue in date);

procedure SetItemAttrEvent
  (itemtype in varchar2,
   itemkey in varchar2,
   name in varchar2,
   event in wf_event_t);

Java Syntax

public static boolean setItemAttrText
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String aName,
   String aValue)

public static boolean setItemAttrNumber
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String aName,
   BigDecimal aValue)

public static boolean setItemAttrDate
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String aName,
   String aValue)

public static boolean setItemAttrDate
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String attributeName,
   java.util.Date attributeValue)

Description

Sets the value of an item type attribute in a process. Use the correct procedure for your attribute type. All attribute types except number, date, and event use SetItemAttrText.

In Java, there are two implementations of setItemAttrDate(). One lets you provide the date value as a Java String object, while the other lets you provide the date value as a Java Date object.

Note: If you need to set the values of large numbers of item type attributes in the same work item at once, use the WF_ENGINE.SetItemAttributeArray APIs rather than the WF_ENGINE.SetItemAttribute APIs for improved performance. See: SetItemAttributeArray.

If you need to set the values of item type attributes in several work items at once, use the WF_ENGINE_BULK.SetItemAttrText, WF_ENGINE_BULK.SetItemAttrNumber, and WF_ENGINE_BULK.SetItemAttrDate APIs rather than the WF_ENGINE.SetItemAttribute APIs. See: WF_ENGINE_BULK.SetItemAttrText, WF_ENGINE_BULK.SetItemAttrNumber, and WF_ENGINE_BULK.SetItemAttrDate.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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. See: CreateProcess.
aname, name, or attributeName The internal name of the item type attribute.
avalue, event, or attributeValue The value for the item type attribute.

Sample Code

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

if (WFEngineAPI.setItemAttrText(ctx, iType, iKey, 
    "REQUESTOR_USERNAME", owner))
  System.out.println("Requestor: "+owner);
  else
{
  WFEngineAPI.showError(ctx);
}

Related Topics

Event Message Structure

setItemAttrFormattedDate

Java Syntax

public static boolean setItemAttrFormattedDate
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String attributeName,
   String attributeValue
   String dateFormat)

Description

Sets the value of an item type attribute of type date in a process with a date value provided as a formatted string.

Arguments (input)

Variable Description
wCtx Workflow context information. See: Oracle Workflow Context.
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. See: CreateProcess.
attributeName The internal name of the item type attribute.
attributeValue The date value for the item type attribute.
dateFormat The format of the date value. The format must be a date format mask that is supported by the Oracle Database. If no format is provided, the default value is the canonical date format for the database. See: Date Formats, Oracle Database Globalization Support Guide.

SetItemAttributeArray

PL/SQL Syntax

procedure SetItemAttrTextArray
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in Wf_Engine.NameTabTyp,
   avalue in Wf_Engine.TextTabTyp);

procedure SetItemAttrNumberArray
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in Wf_Engine.NameTabTyp,
   avalue in Wf_Engine.NumTabTyp);

procedure SetItemAttrDateArray
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in Wf_Engine.NameTabTyp,
   avalue in Wf_Engine.DateTabTyp);

Description

Sets the values of an array of item type attributes in a process. Use the SetItemAttributeArray APIs rather than the SetItemAttribute APIs for improved performance when you need to set the values of large numbers of item type attributes at once.

Use the correct procedure for your attribute type. All attribute types except number, date, and event use SetItemAttrTextArray.

Note: If you need to set the values of item type attributes in several work items at once, use the WF_ENGINE_BULK.SetItemAttrText, WF_ENGINE_BULK.SetItemAttrNumber, and WF_ENGINE_BULK.SetItemAttrDate APIs rather than the WF_ENGINE.SetItemAttributeArray APIs. See: WF_ENGINE_BULK.SetItemAttrText, WF_ENGINE_BULK.SetItemAttrNumber, and WF_ENGINE_BULK.SetItemAttrDate.

Arguments (input)

Variable Description
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. See: CreateProcess.
aname An array of the internal names of the item type attributes.
avalue An array of the values for the item type attributes.

Sample Code

The following example shows how using the SetItemAttributeArray APIs rather than the SetItemAttribute APIs can help reduce the number of calls to the database.

Using SetItemAttrText():

SetItemAttrText('ITYPE', 'IKEY', 'VAR1', 'value1');
SetItemAttrText('ITYPE', 'IKEY', 'VAR2', 'value2');
SetItemAttrText('ITYPE', 'IKEY', 'VAR3', 'value3');

// Multiple calls to update the database.
 

Using SetItemAttrTextArray():

declare
  varname   Wf_Engine.NameTabTyp;
  varval    Wf_Engine.TextTabTyp;
begin
  varname(1) := 'VAR1';
  varval(1)  := 'value1';
  varname(2) := 'VAR2';
  varval(2)  := 'value2';
  varname(3) := 'VAR3';
  varval(3)  := 'value3';
Wf_Engine.SetItemAttrTextArray('ITYPE', 'IKEY', varname, varval);
exception
  when OTHERS then
    // handle your errors here
    raise;
end;

// Only one call to update the database.

getItemTypes

Java Syntax

public static WFTwoDArray getItemTypes
  (WFContext wCtx)

Description

Returns a list of all the item types defined in the Oracle Workflow database as a two-dimensional data object.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.

GetItemAttribute

PL/SQL Syntax

function GetItemAttrText
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2,
   ignore_notfound in boolean default FALSE) 
  return varchar2;

function GetItemAttrNumber
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2,
   ignore_notfound in boolean default FALSE) 
  return number;

function GetItemAttrDate
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2,
   ignore_notfound in boolean default FALSE) 
  return date;

function GetItemAttrEvent
  (itemtype in varchar2,
   itemkey in varchar2,
   name in varchar2) 
  return wf_event_t;

Description

Returns the value of an item type attribute in a process. Use the correct function for your attribute type. All attribute types except number, date, and event use GetItemAttrText.

For GetItemAttrText(), GetItemAttrNumber(), and GetItemAttrDate(), you can specify TRUE for the ignore_notfound parameter to ignore the exception encountered if the specified item type attribute does not exist. In this case the function returns a null value but does not raise an exception. For example, you can use this parameter if a new item type attribute is added to an item type, and your code needs to handle both the earlier version and the upgraded version of the item type.

Arguments (input)

Variable Description
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. See: CreateProcess.
aname The internal name of an item type attribute, for GetItemAttrText(), GetItemAttrNumber(), and GetItemAttrDate().
name The internal name of an item type attribute, for GetItemAttrEvent().
ignore_notfound Specify TRUE or FALSE to indicate whether to ignore the exception if the specified item type attribute does not exist, for GetItemAttrText(), GetItemAttrNumber(), and GetItemAttrDate(). If you specify TRUE and the item type attribute you specify does not exist, the function returns a null value but does not raise an exception. Defaults to FALSE.

Related Topics

Event Message Structure

GetItemAttrClob

PL/SQL Syntax

function GetItemAttrClob
  (itemtype in varchar2,
   itemkey in varchar2,
   aname in varchar2) 
  return clob;

Description

Returns the value of an item type attribute in a process as a character large object (CLOB).

Arguments (input)

Variable Description
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. See: CreateProcess.
aname The internal name of an item type attribute.

getItemAttributes

Java Syntax

public static WFTwoDArray getItemAttributes
  (WFContext wCtx,
   String itemType,
   String itemKey)

Description

Returns a list of all the item attributes, their types, and their values for the specified item type instance as a two-dimensional data object.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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. See: CreateProcess.

GetItemAttrInfo

PL/SQL Syntax

procedure GetItemAttrInfo
  (itemtype in varchar2,
   aname in varchar2,
   atype out varchar2,
   subtype out varchar2,
   format out varchar2);

Description

Returns information about an item type attribute, such as its type and format, if any is specified. Currently, subtype information is not available for item type attributes.

Arguments (input)

Variable Description
itemtype A valid item type.
aname The internal name of an item type attribute.

GetActivityAttrInfo

PL/SQL Syntax

procedure GetActivityAttrInfo
  (itemtype in varchar2,
   itemkey in varchar2,
   actid in number,
   aname in varchar2,
   atype out varchar2,
   subtype out varchar2,
   format out varchar2);

Description

Returns information about an activity attribute, such as its type and format, if any is specified. This procedure currently does not return any subtype information for activity attributes.

Arguments (input)

Variable Description
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. See: CreateProcess.
actid The activity ID for a particular usage of an activity in a process definition. Also referred to as the activity ID of the node.
aname The internal name of an activity attribute.

GetActivityAttribute

PL/SQL Syntax

function GetActivityAttrText
  (itemtype in varchar2,
   itemkey in varchar2,
   actid in number,
   aname in varchar2,
   ignore_notfound in boolean default FALSE) 
  return varchar2;

function GetActivityAttrNumber
  (itemtype in varchar2,
   itemkey in varchar2,
   actid in number,
   aname in varchar2,
   ignore_notfound in boolean default FALSE) 
  return number;

function GetActivityAttrDate
  (itemtype in varchar2,
   itemkey in varchar2,
   actid in number,
   aname in varchar2, 
   ignore_notfound in boolean default FALSE) 
  return date;

function GetActivityAttrEvent
  (itemtype in varchar2,
   itemkey in varchar2,
   actid in number,
   name in varchar2) 
  return wf_event_t;

Description

Returns the value of an activity attribute in a process. Use the correct function for your attribute type. If the attribute is a Number or Date type, then the appropriate function translates the number/date value to a text-string representation using the attribute format.

Note: Use GetActivityAttrText() for form, URL, lookup, role, attribute, and document attribute types.

For GetActivityAttrText(), GetActivityAttrNumber(), and GetActivityAttrDate(), you can specify TRUE for the ignore_notfound parameter to ignore the exception encountered if the specified activity attribute does not exist. In this case the function returns a null value but does not raise an exception. For example, you can use this parameter if a new activity attribute is added to an activity, and your code needs to handle both the earlier version and the upgraded version of the activity.

Arguments (input)

Variable Description
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. See: CreateProcess.
actid The activity ID for a particular usage of an activity in a process definition. Also referred to as the activity ID of the node.
aname The internal name of an activity attribute, for GetActivityAttrText(), GetActivityAttrNumber(), and GetActivityAttrDate().
name The internal name of an activity attribute, for GetActivityAttrEvent().
ignore_notfound Specify TRUE or FALSE to indicate whether to ignore the exception if the specified activity attribute does not exist, for GetActivityAttrText(), GetActivityAttrNumber(), and GetActivityAttrDate(). If you specify TRUE and the activity attribute you specify does not exist, the function returns a null value but does not raise an exception. Defaults to FALSE.

Related Topics

Event Message Structure

GetActivityAttrClob

PL/SQL Syntax

function GetActivityAttrClob
  (itemtype in varchar2,
   itemkey in varchar2,
   actid in number,
   aname in varchar2) 
  return clob;

Description

Returns the value of an activity attribute in a process as a character large object (CLOB).

Arguments (input)

Variable Description
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. See: CreateProcess.
actid The activity ID for a particular usage of an activity in a process definition. Also referred to as the activity ID of the node.
aname The internal name of an activity attribute.

getActivityAttributes

Java Syntax

public static WFTwoDArray getActivityAttributes
  (WFContext wCtx,
   String itemType,
   String itemKey,
   BigDecimal actID)

Description

Returns a list of all the activity attributes, their types, and their values for the specified activity as a two-dimensional data object.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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. See: CreateProcess.
actID The activity ID for a particular usage of an activity in a process definition. Also referred to as the activity ID of the node.

BeginActivity

PL/SQL Syntax

procedure BeginActivity
  (itemtype in varchar2,
   itemkey in varchar2,
   activity in varchar2);

Description

Determines if the specified activity can currently be performed on the process item and raises an exception if it cannot.

The CompleteActivity() procedure automatically performs this function as part of its validation. However, you can use BeginActivity() to verify that the activity you intend to perform is currently allowed before actually calling it. See: CompleteActivity.

Arguments (input)

Variable Description
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 activity node to perform on the process. Provide the activity node's label name. If the activity node label name does not uniquely identify the activity node you can precede the label name with the internal name of its parent process. For example:
<parent_process_internal_name>:<label_name>

Sample Code

/* Verify that a credit check can be performed on an order.  If it 
 * is allowed, perform the credit check, then notify the Workflow 
 * Engine when the credit check completes. */

begin
  wf_engine.BeginActivity('ORDER', to_char(order_id),
    'CREDIT_CHECK');
  OK := TRUE;
exception
  when others then
    WF_CORE.Clear;
    OK := FALSE;
end;

if OK then
  -- perform activity --
  wf_engine.CompleteActivity('ORDER', to_char(order_id),
    'CREDIT_CHECK' :result_code);
end if;

CompleteActivity

PL/SQL Syntax

procedure CompleteActivity
  (itemtype in varchar2,
   itemkey in varchar2,
   activity in varchar2,
  result in varchar2);

Java Syntax

public static boolean completeActivity
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String activity,
   String result)

Description

Notifies the Workflow Engine that the specified activity has been completed for a particular item. This procedure can be called for the following situations:

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
itemtype or itemType A valid item type.
itemkey or 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 An optional activity completion result. Possible values are determined by the process activity's Result Type, or one of the engine standard results. See: AbortProcess.

Sample Code

Example 1

/* Complete the 'ENTER ORDER' activity for the 'ORDER' item type.  
 * The 'ENTER ORDER' activity allows creation of new items since 
 * it is the start of a workflow, so the item is created by this 
 * call as well. */

wf_engine.CompleteActivity('ORDER', to_char(order.order_id),
  'ENTER_ORDER', NULL);

Example 2

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

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

Example 3

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

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

CompleteActivityInternalName

PL/SQL Syntax

procedure CompleteActivityInternalName
  (itemtype in varchar2,
   itemkey in varchar2,
   activity in varchar2,
   result in varchar2);

Description

Notifies the Workflow Engine that the specified activity has been completed for a particular item. This procedure requires that the activity currently has a status of 'Notified'. An optional activity completion result can also be passed. The result can determine what transition the process takes next.

CompleteActivityInternalName() is similar to CompleteActivity() except that CompleteActivityInternalName() identifies the activity to be completed by the activity's internal name, while CompleteActivity() identifies the activity by the activity node label name. You should only use CompleteActivityInternalName() when you do not know the activity node label name. If you do know the activity node label name, use CompleteActivity() instead. See: CompleteActivity.

Note: Unlike CompleteActivity(), you cannot use CompleteActivityInternalName() to start a process. Also, you cannot use CompleteActivityInternalName() with a synchronous process.

When CompleteActivityInternalName() is executed, there must be exactly one instance of the specified activity with a status of 'Notified'. If there are multiple instances of the activity with 'Notified' statuses, the process enters an 'ERROR' state.

Arguments (input)

Variable Description
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 internal name of the activity that is completed. If the activity internal name does not uniquely identify the subprocess you can precede the activity internal name with the internal name of its parent process. For example:
<parent_process_internal_name>:<activity_internal_name>
result An optional activity completion result. Possible values are determined by the process activity's result type, or one of the engine standard results. See: AbortProcess.

AssignActivity

PL/SQL Syntax

procedure AssignActivity
  (itemtype in varchar2,
   itemkey in varchar2,
   activity in varchar2,
   performer in varchar2);

Description

Assigns or reassigns an activity to another performer. This procedure may be called before the activity is transitioned to. For example, a function activity earlier in the process may determine the performer of a later activity.

If a new user is assigned to a notification activity that already has an outstanding notification, the outstanding notification is canceled and a new notification is generated for the new user by calling WF_Notification.Transfer.

Arguments (input)

Variable Description
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 label name of the activity node. If the activity node label name does not uniquely identify the activity node you can precede the label name with the internal name of its parent process. For example:
<parent_process_internal_name>:<label_name>
performer The name of the user who will perform the activity (the user who receives the notification). The name should be a role name from the Oracle Workflow directory service.

Event

PL/SQL Syntax

procedure Event
  (itemtype in varchar2,
   itemkey in varchar2,
   process_name in varchar2 default null,
   event_message in wf_event_t);

Description

Receives an event from the Business Event System into a workflow process.

If the specified item key already exists, the event is received into that item. If the item key does not already exist, but the specified process includes an eligible Receive event activity marked as a Start activity, the Workflow Engine creates a new item running that process.

Within the workflow process that receives the event, the procedure searches for eligible Receive event activities. For an activity to be eligible to receive an event, its event filter must either be set to that particular event, set to an event group of which that event is a member, or left blank to accept any event. Additionally, the activity must either be marked as a Start activity, or it must have an activity status of NOTIFIED, meaning the process has transitioned to that activity and is waiting to receive the event.

For each eligible Receive event activity, Event() stores the event name, event key, and event message in the item type attributes specified in the event activity node, if they have been defined. Additionally, the procedure sets any parameters in the event message parameter list as item type attributes for the process, creating new item type attributes if a corresponding attribute does not already exist for any parameter. It also sets the subscription's globally unique identifier (GUID) as a dynamic item attribute so that the workflow process can reference other information in the subscription definition. Then the Workflow Engine begins a thread of execution from the event activity.

If no eligible Receive event activity exists for a received event, the procedure returns an exception and an error message.

Note: If an event arrives at a Start activity to launch a new process instance, the Workflow Engine also searches for all other receive event activities that are marked as Start activities and that do not have any incoming transitions, regardless of their event filter. For these activities, the Workflow Engine sets the activity status to NOTIFIED so that they will be ready to receive an event if any more events are sent to this process. This feature lets you design a workflow process that requires multiple events to be received when you do not know in advance the order in which the events will arrive.

Note: If the event received by a Receive event activity was originally raised by a Raise event activity in another workflow process, the item type and item key for that process are included in the parameter list within the event message. In this case, the Workflow Engine automatically sets the specified process as the parent for the process that receives the event, overriding any existing parent setting.

Arguments (input)

Variable Description
itemtype A valid item type.
itemkey A string that uniquely identifies the item within an item type. The item type and key together identify the process.

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

process_name An optional argument that allows the selection of a particular subprocess for that item type. Provide the process activity's label name. If the process activity 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>

If this argument is null, the top level process for the item is started. This argument defaults to null.
event_message The event message containing the details of the event.

HandleError

PL/SQL Syntax

procedure HandleError
  (itemtype in varchar2,
   itemkey in varchar2,
   activity in varchar2,
   command in varchar2,
   result in varchar2);

Java Syntax

public static boolean handleError
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String activity,
   String command,
   String result)

Description

This procedure is generally called from an activity in an ERROR process to handle any process activity that has encountered an error.

You can also call this procedure for any arbitrary activity in a process, to roll back part of your process to that activity. The activity that you call this procedure with can have any status and does not need to have been executed. The activity can also be in a subprocess. If the activity node label is not unique within the process you can precede the activity node label name with the internal name of its parent process. For example:

<parent_process_internal_name>:<label_name>

This procedure clears the activity specified and all activities following it that have already been transitioned to by reexecuting each activity in CANCEL mode. For an activity in the 'Error' state, there are no other executed activities following it, so the procedure simply clears the errored activity.

Once the activities are cleared, this procedure resets any parent processes of the specified activity to a status of 'Active', if they are not already active.

The procedure then handles the specified activity based on the command you provide: SKIP or RETRY.

This API also raises the oracle.apps.wf.engine.skip event or the oracle.apps.wf.engine.retry event, depending on the command you provide. Although Oracle Workflow does not include any predefined subscriptions to these events, you can optionally define your own subscriptions to these events if you want to perform custom processing when they occur. See: Workflow Engine Events, Oracle Workflow Developer's Guide and To Create or Update an Event Subscription, Oracle Workflow Developer's Guide.

Note: An item's active date and the version number of the process that the item is transitioning through can never change once an item is created. Occasionally, however, you may want to use HandleError to manually make changes to your process for an existing item.

If the changes you make to a process are minor, you can use HandleError to manually push an item through activities that will error or redirect the item to take different transitions in the process.

If the changes you want to make to a process are extensive, then you need to perform at least the following steps:

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
item_type or itemType A valid item type.
item_key or 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 activity node that encountered the error or that you want to undo. Provide the label name of the activity node. 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>
command One of two commands that determine how to handle the process activity:
  • SKIP - do not reexecute the activity, but mark the activity as complete with the supplied result and continue execution of the process from that activity.

  • RETRY - reexecute the activity and continue execution of the process from that activity.

result The result you wish to supply if the command is SKIP.

SetItemParent

PL/SQL Syntax

procedure SetItemParent
  (itemtype in varchar2,
   itemkey in varchar2,
   parent_itemtype in varchar2,
   parent_itemkey in varchar2,
   parent_context in varchar2);

Java Syntax

public static boolean setItemParent
  (WFContext wCtx,
   String itemType,
   String itemKey,
   String parentItemType,
   String parentItemKey,
   String parentContext)

Description

Defines the parent/child relationship for a master process and a detail process. This API must be called by any detail process spawned from a master process to define the parent/child relationship between the two processes. You make a call to this API after you call the CreateProcess API, but before you call the StartProcess API for the detail process.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
itemtype or itemType A valid item type.
itemkey or 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 child process.

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

parent_itemtype or parentItemType A valid item type for the parent process.
parent_itemkey or parentItemKey A string generated from the application object's primary key to uniquely identify the item within the parent item type. The parent item type and key together identify the parent process.

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

parent_context or parentContext You can leave the parent context null if the parent process contains only one Wait for Flow activity, or if the parent process contains multiple Wait for Flow activities and this detail process includes a Continue Flow activity for every Wait for Flow activity in the parent process.
If the parent process contains multiple Wait for Flow activities and this detail process only includes a Continue Flow activity for one of those Wait for Flow activities, set this parameter to the activity label name for the Wait for Flow activity node to which this detail process corresponds.

ItemStatus

PL/SQL Syntax

procedure ItemStatus
  (itemtype in varchar2,
   itemkey in varchar2,
   status out varchar2,
   result out varchar2);

Java Syntax

public static WFTwoDArray itemStatus
  (WFContext wCtx,
   String itemType,
   String itemKey)

Description

Returns the status and result for the root process of the specified item instance. Possible values returned for the status are: ACTIVE, COMPLETE, ERROR, or SUSPENDED. If the root process does not exist, then the item key does not exist and will thus cause the procedure to raise an exception.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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 item instance.

Sample Code

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

// get status and result for this item
dataSource = WFEngineAPI.itemStatus(ctx, iType, iKey);
System.out.print("Status and result for " + iType + "/" + 
    iKey + " = ");
displayDataSource(ctx, dataSource);

getProcessStatus

Java Syntax

public static WFTwoDArray getProcessStatus
  (WFContext wCtx,
   String itemType,
   String itemKey,
   BigDecimal process)

Description

Returns the process status for the given item type instance as a two-dimensional data object.

Arguments (input)

Variable Description
wCtx Workflow context information. Required for the Java method only. See: Oracle Workflow Context.
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. See: CreateProcess.
process A process instance ID for the item type. If the instance ID is unknown, you can simply provide any negative number and the method will return the process status for the root process.

Workflow Engine Bulk APIs

The Workflow Engine bulk APIs can be called by an application program in an Oracle E-Business Suite installation to launch multiple work items at once in bulk and to set values for item attributes in bulk across multiple work items. These APIs are defined in a PL/SQL package called WF_ENGINE_BULK.

Some Workflow Engine bulk APIs use PL/SQL table composite datatypes defined in the WF_ENGINE_BULK package. The following table shows the column datatype definition for each PL/SQL table type.

PL/SQL Table Types in WF_ENGINE_BULK
PL/SQL Table Type Column Datatype Definition
ItemKeyTabType varchar2(240)
UserKeyTabType varchar2(240)
OwnerRoleTabType varchar2(320)

Some Workflow Engine bulk APIs also use PL/SQL table composite datatypes defined in the WF_ENGINE package. See: PL/SQL Table Types in WF_ENGINE.

WF_ENGINE_BULK.CreateProcess

PL/SQL Syntax

procedure CreateProcess
  (itemtype in varchar2,
   itemkeys in wf_engine_bulk.itemkeytabtype,
   process in varchar2,
   user_keys in wf_engine_bulk.userkeytabtype,
   owner_roles in wf_engine_bulk.ownerroletabtype,
   parent_itemtype in varchar2 default null,
   parent_itemkey in varchar2 default null,
   parent_context in varchar2 default null,
   masterdetail in boolean default null);

Description

Creates multiple new runtime process instances of the specified item type at once, based on the specified array of workflow item keys. You can optionally specify one existing work item as the parent for all the new work items.

Note: You cannot use WF_ENGINE_BULK.CreateProcess() to create forced synchronous processes.

If processing fails for any work items, then WF_ENGINE_BULK.CreateProcess() adds those item keys to a global PL/SQL table called g_FailedItems within the WF_ENGINE_BULK package. The procedure then continues processing the remaining items. When processing is complete, the procedure raises an exception for any failed items.

Arguments (input)

Variable Description
itemtype A valid item type.
itemkeys An array of item keys that identify the work items to be created. An item key is a string derived from the application object's primary key that uniquely identifies a work item within an item type. The item type and item key must be passed to all subsequent API calls for the work item.

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

You must provide a unique item key for each work item to be created. You cannot use WF_ENGINE_BULK.CreateProcess() to create forced synchronous processes with the generic #SYNCH item key.

process Optionally specify the internal name of the process that you want to run within the specified item type. If this parameter is null, the Workflow Engine uses the item type's selector function to determine the top-level process to run for the first work item being created, and then selects the same process to run for all the other work items. If this parameter is null and the item type does not include a selector function, then WF_ENGINE_BULK.CreateProcess() raises an error.
user_keys An optional array of user-friendly keys to assign to the new work items. The array of user keys must correspond on a one-to-one basis with the array of item keys.
owner_roles An optional array of valid roles to set as the owners of the new work items. The array of owner roles must correspond on a one-to-one basis with the array of item keys.
parent_itemtype The item type of the parent work item, if you want to define a parent/child relationship between an existing work item and the new work items.
parent_itemkey The item key that identifies the parent work item within its item type.

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

parent_context You can leave the parent context null if the parent process contains only one Wait for Flow activity, or if the parent process contains multiple Wait for Flow activities and these child processes include a Continue Flow activity for every Wait for Flow activity in the parent process.
If the parent process contains multiple Wait for Flow activities and these child processes each only include a Continue Flow activity for one of those Wait for Flow activities, set this parameter to the activity label name for the Wait for Flow activity node to which these child processes correspond.
masterdetail Specify TRUE or FALSE to indicate whether to perform master/detail coordination between the parent process and the child processes.

Related Topics

WF_ENGINE.CreateProcess

Synchronous, Asynchronous, and Forced Synchronous Processes

WF_ENGINE_BULK.StartProcess

PL/SQL Syntax

procedure StartProcess
  (itemtype in varchar2,
   itemkeys in wf_engine_bulk.itemkeytabtype);

Description

Begins execution of multiple new runtime process instances at once, identified by the specified item type and array of workflow item keys. The Workflow Engine locates the activity marked as a Start activity in the process definition and then defers that activity for each of the new work items. Ensure that you run a background engine to process the deferred activities and continue executing the work items.

You must call either WF_ENGINE.CreateProcess() or WF_ENGINE_BULK.CreateProcess() to define the item type and item keys before calling WF_ENGINE_BULK.StartProcess().

Note: You cannot use WF_ENGINE_BULK.StartProcess() to start forced synchronous processes.

If processing fails for any work items, then WF_ENGINE_BULK.StartProcess() adds those item keys to a global PL/SQL table called g_FailedItems within the WF_ENGINE_BULK package. The procedure then continues processing the remaining items. When processing is complete, the procedure raises an exception for any failed items.

Arguments (input)

Variable Description
itemtype A valid item type.
itemkeys An array of item keys that identify the work items to be started. An item key is a string derived from the application object's primary key that uniquely identifies a work item within an item type.

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

You must provide a unique item key for each work item to be started. You cannot use WF_ENGINE_BULK.StartProcess() to start forced synchronous processes with the generic #SYNCH item key.

Related Topics

WF_ENGINE.StartProcess

Setting Up Background Workflow Engines, Oracle Workflow Administrator's Guide

Synchronous, Asynchronous, and Forced Synchronous Processes

WF_ENGINE_BULK.FastForward

PL/SQL Syntax

procedure FastForward
  (itemtype in varchar2,
   itemkeys in wf_engine_bulk.itemkeytabtype,
   process in varchar2,
   activity in varchar2,
   activityStatus in varchar2 default null,
   parent_itemtype in varchar2 default null,
   parent_itemkey in varchar2 default null,
   parent_context in varchar2  default null,
   masterdetail in boolean default null);

Description

Creates multiple new runtime process instances of the specified item type at once, based on the specified array of workflow item keys, and begins execution of the new work items at the specified activity. You can optionally specify one existing work item as the parent for all the new work items.

The activity at which execution begins must be marked as a Start activity. However, it can have incoming transitions. The activity must be a direct child of the process in which execution of the work item begins. It cannot be part of a subprocess.

The Workflow Engine first calls WF_ENGINE_BULK.CreateProcess() to create the new work items and then sets the Start activity for each work item to the specified status, either 'DEFERRED' or 'NOTIFIED'.

Note: You cannot use WF_ENGINE_BULK.FastForward() to start forced synchronous processes.

If processing fails for any work items, then WF_ENGINE_BULK.FastForward() adds those item keys to a global PL/SQL table called g_FailedItems within the WF_ENGINE_BULK package. The procedure then continues processing the remaining items. When processing is complete, the procedure raises an exception for any failed items.

Arguments (input)

Variable Description
itemtype A valid item type.
itemkeys An array of item keys that identify the work items to be started. An item key is a string derived from the application object's primary key that uniquely identifies a work item within an item type. The item type and item key must be passed to all subsequent API calls for the work item.

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

You must provide a unique item key for each work item to be started. You cannot use WF_ENGINE_BULK.CreateProcess() to start forced synchronous processes with the generic #SYNCH item key.

process Optionally specify the internal name of the process that you want to run within the specified item type. If this parameter is null, the Workflow Engine uses the item type's selector function to determine the top-level process to run for the first work item being created, and then selects the same process to run for all the other work items. If this parameter is null and the item type does not include a selector function, then WF_ENGINE_BULK.FastForward() raises an error.
activity The name of the activity node at which you want to begin execution of the work items. Specify the activity node's label name. If the activity node label name is not unique within the item type, you can precede the label name with the internal name of its parent process in the following format:
<parent_process_internal_name>:<label_name>

This activity node must be marked as a Start activity.
activityStatus The status to set for the Start activity in each work item, either 'DEFERRED' or 'NOTIFIED'. If this parameter is null, the Workflow Engine sets the activity statuses to 'DEFERRED'.
parent_itemtype The item type of the parent work item, if you want to define a parent/child relationship between an existing work item and the new work items.
parent_itemkey The item key that identifies the parent work item within its item type.

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

parent_context You can leave the parent context null if the parent process contains only one Wait for Flow activity, or if the parent process contains multiple Wait for Flow activities and these child processes include a Continue Flow activity for every Wait for Flow activity in the parent process.
If the parent process contains multiple Wait for Flow activities and these child processes each only include a Continue Flow activity for one of those Wait for Flow activities, set this parameter to the activity label name for the Wait for Flow activity node to which these child processes correspond.
masterdetail Specify TRUE or FALSE to indicate whether to perform master/detail coordination between the parent process and the child processes.

Related Topics

WF_ENGINE.LaunchProcess

WF_ENGINE.CompleteActivity

WF_ENGINE.CompleteActivityInternalName

WF_ENGINE.Event

Setting Up Background Workflow Engines, Oracle Workflow Administrator's Guide

Synchronous, Asynchronous, and Forced Synchronous Processes

WF_ENGINE_BULK.SetItemAttrText

PL/SQL Syntax

procedure SetItemAttrText
  (itemtype in varchar2,
   itemkeys in Wf_Engine_Bulk.ItemKeyTabType,
   anames in Wf_Engine.NameTabTyp,
   avalues in Wf_Engine.TextTabTyp);

Description

Sets the values of an array of item type attributes of type text in multiple work items, identified by the specified item type and array of item keys. You can also use this API to set attributes of type role, form, URL, lookup, or document.

This API sets the value of one item type attribute in each work item. Consequently, the array of item keys must correspond on a one-to-one basis with the array of item type attribute names and with the array of item type attribute values.

Note: If you need to set the values of large numbers of item type attributes in the same work item, use WF_ENGINE.SetItemAttrTextArray() rather than WF_ENGINE_BULK.SetItemAttrText().

If processing fails for any work items, then WF_ENGINE_BULK.SetItemAttrText() adds those item keys to a global PL/SQL table called g_FailedItems within the WF_ENGINE_BULK package and also adds the corresponding item type attribute names to a global PL/SQL table called g_FailedAttributes. The procedure then continues processing the remaining items. When processing is complete, the procedure raises an exception for any failed items.

Arguments (input)

Variable Description
itemtype A valid item type.
itemkeys An array of the item keys that identify the work items to which the item type attributes belong. An item key is a string derived from the application object's primary key that uniquely identifies a work item within an item type.

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

anames An array of the internal names of the item type attributes. The array of item type attribute names must correspond on a one-to-one basis with the array of item keys.
avalues An array of the values for the item type attributes. The array of item type attribute values must correspond on a one-to-one basis with the array of item keys.

Related Topics

WF_ENGINE.SetItemAttributeArray

WF_ENGINE.SetItemAttribute

WF_ENGINE_BULK.SetItemAttrNumber

PL/SQL Syntax

procedure SetItemAttrNumber
  (itemtype in varchar2,
   itemkeys in Wf_Engine_Bulk.ItemKeyTabType,
   anames in Wf_Engine.NameTabTyp,
   avalues in Wf_Engine.NumTabTyp);

Description

Sets the values of an array of item type attributes of type number in multiple work items, identified by the specified item type and array of item keys.

This API sets the value of one item type attribute in each work item. Consequently, the array of item keys must correspond on a one-to-one basis with the array of item type attribute names and with the array of item type attribute values.

Note: If you need to set the values of large numbers of item type attributes in the same work item, use WF_ENGINE.SetItemAttrNumberArray() rather than WF_ENGINE_BULK.SetItemAttrNumber().

If processing fails for any work items, then WF_ENGINE_BULK.SetItemAttrNumber() adds those item keys to a global PL/SQL table called g_FailedItems within the WF_ENGINE_BULK package and also adds the corresponding item type attribute names to a global PL/SQL table called g_FailedAttributes. The procedure then continues processing the remaining items. When processing is complete, the procedure raises an exception for any failed items.

Arguments (input)

Variable Description
itemtype A valid item type.
itemkeys An array of the item keys that identify the work items to which the item type attributes belong. An item key is a string derived from the application object's primary key that uniquely identifies a work item within an item type.

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

anames An array of the internal names of the item type attributes. The array of item type attribute names must correspond on a one-to-one basis with the array of item keys.
avalues An array of the values for the item type attributes. The array of item type attribute values must correspond on a one-to-one basis with the array of item keys.

Related Topics

WF_ENGINE.SetItemAttributeArray

WF_ENGINE.SetItemAttribute

WF_ENGINE_BULK.SetItemAttrDate

PL/SQL Syntax

procedure SetItemAttrDate
  (itemtype in varchar2,
   itemkeys in Wf_Engine_Bulk.ItemKeyTabType,
   anames in Wf_Engine.NameTabTyp,
   avalues in Wf_Engine.DateTabTyp);

Description

Sets the values of an array of item type attributes of type date in multiple work items, identified by the specified item type and array of item keys.

This API sets the value of one item type attribute in each work item. Consequently, the array of item keys must correspond on a one-to-one basis with the array of item type attribute names and with the array of item type attribute values.

Note: If you need to set the values of large numbers of item type attributes in the same work item, use WF_ENGINE.SetItemAttrDateArray() rather than WF_ENGINE_BULK.SetItemAttrDate().

If processing fails for any work items, then WF_ENGINE_BULK.SetItemAttrDate() adds those item keys to a global PL/SQL table called g_FailedItems within the WF_ENGINE_BULK package and also adds the corresponding item type attribute names to a global PL/SQL table called g_FailedAttributes. The procedure then continues processing the remaining items. When processing is complete, the procedure raises an exception for any failed items.

Arguments (input)

Variable Description
itemtype A valid item type.
itemkeys An array of the item keys that identify the work items to which the item type attributes belong. An item key is a string derived from the application object's primary key that uniquely identifies a work item within an item type.

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

anames An array of the internal names of the item type attributes. The array of item type attribute names must correspond on a one-to-one basis with the array of item keys.
avalues An array of the values for the item type attributes. The array of item type attribute values must correspond on a one-to-one basis with the array of item keys.

Related Topics

WF_ENGINE.SetItemAttributeArray

WF_ENGINE.SetItemAttribute

Workflow Function APIs

The WFFunctionAPI Java class is an abstract class from which other Java procedures can be derived. This class contains methods for accessing item type and activity attributes.

The WFFunctionAPI class is stored in the oracle.apps.fnd.wf Java package. The following list shows the APIs available in this class.

Important: Java is case-sensitive and all Java method names begin with a lower case letter to follow Java naming conventions.

Related Topics

Function Activity, Oracle Workflow Developer's Guide

loadItemAttributes

Java Syntax

public void loadItemAttributes
  (WFContext pWCtx) throws SQLException

Description

Retrieves the item attributes from the database for the item type associated with the custom function. The item attributes are not loaded by default due to the performance impact that could occur if the item type contains a large number of item attributes. You can use this method to load the item attributes explicitly before accessing them.

If a database access error occurs, this method throws a SQLException.

Arguments (input)

Variable Description
pWCtx Workflow context information. See: Oracle Workflow Context.

loadActivityAttributes

Java Syntax

public void loadActivityAttributes
  (WFContext pWCtx,
   String iType,
   String iKey,
   BigDecimal actid) throws SQLException

Description

Retrieves the activity attributes from the database for the specified activity. This method is called by default when the custom function activity is instantiated and before the execute() function is called.

If a database access error occurs, this method throws a SQLException.

Arguments (input)

Variable Description
pWCtx Workflow context information. See: Oracle Workflow Context.
iType A valid item type.
iKey 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. See: CreateProcess.
actid An activity instance ID.

getActivityAttr

Java Syntax

public WFAttribute getActivityAttr
  (String aName)

public WFAttribute getActivityAttr
  (WFContext pWCtx,
   String aName) throws SQLException

Description

There are two implementations of getActivityAttr(). These methods return the activity attribute information for the specified activity attribute.

Arguments (input)

Variable Description
pWCtx Workflow context information. Required for the second method only. See: Oracle Workflow Context.
aName The internal name of an activity attribute.

getItemAttr

Java Syntax

public WFAttribute getItemAttr
  (String aName)

Description

Returns the item attribute information for the specified item attribute.

Arguments (input)

Variable Description
aName The internal name of an item attribute.

setItemAttrValue

Java Syntax

public void setItemAttrValue
  (WFContext pWCtx, 
   WFAttribute pAttr) 
  throws NumberFormatException, WFException

Description

Sets the value of the specified item attribute in the database.

This method throws a NumberFormatException if it cannot convert the value to the appropriate format for an attribute of type number or date. The method throws a WFException if it encounters an error while setting an attribute of type document or text.

Arguments (input)

Variable Description
pWCtx Workflow context information. See: Oracle Workflow Context.
pAttr The attribute information for an item attribute.

execute

Java Syntax

public abstract boolean execute
  (WFContext pWCtx)

Description

This abstract method is implemented by the extending class and forms the main entry point of a custom function.

Arguments (input)

Variable Description
pWCtx Workflow context information. See: Oracle Workflow Context.

Workflow Attribute APIs

The WFAttribute Java class contains descriptive information for an item or activity attribute, including the internal name of the attribute, attribute value, attribute data type, format information, and default value type. The attribute value is stored as an Object type. This class also contains methods for accessing the attribute information, which can be called by a Java application.

The WFAttribute class is stored in the oracle.apps.fnd.wf Java package. The following list shows the APIs available in this class.

Important: Java is case-sensitive and all Java method names, except the constructor method names, begin with a lower case letter to follow Java naming conventions.

WFAttribute Class Constants

The WFAttribute class contains several constants. The following table shows the constants that can be used to represent the data type of an attribute.

Data Type Constants
Constant Variable Declaration Constant Value
public static final String TEXT "TEXT"
public static final String NUMBER "NUMBER"
public static final String DATE "DATE"
public static final String LOOKUP "LOOKUP"
public static final String FORM "FORM"
public static final String URL "URL"
public static final String DOCUMENT "DOCUMENT"
public static final String ROLE "ROLE"
public static final String EVENT "EVENT"

The following table shows the constants that can be used to represent the type of the default value for an attribute. The default value can be either a constant or, for an activity attribute, a reference to an item type attribute.

Default Value Type Constants
Constant Variable Declaration Constant Value
public static final String CONSTANT "CONSTANT"
public static final String ITEMATTR "ITEMATTR"

WFAttribute

Java Syntax

public WFAttribute()

public WFAttribute
  (String pName
   String pType,
   Object pValue,
   String pValueType)

Description

There are two constructor methods for the WFAttribute class. The first constructor creates a new WFAttribute object. The second constructor creates a new WFAttribute object and initializes it with the specified attribute name, attribute type, value, and value type.

Arguments (input)

Variable Description
pName The internal name of an item or activity attribute. Required for the second method only.
pType The data type of the attribute. Required for the second method only.
pValue The attribute value. Required for the second method only.
pValueType The type of the default value for the attribute. The default value can be either a constant or, for an activity attribute, a reference to an item type attribute. Required for the second method only.

value

Java Syntax

public void value
  (Object pValue)

Description

Sets the value of the item or activity attribute within a WFAttribute object. The value must be cast to the Object type.

Important: Using value() to set the attribute value within a WFAttribute object does not set the attribute value in the database. To set the value of an item attribute in the database, use WFFunctionAPI.setItemAttrValue(). See: setItemAttrValue.

Arguments (input)

Variable Description
pValue The attribute value.

getName

Java Syntax

public String getName()

Description

Returns the internal name of the item or activity attribute.

getValue

Java Syntax

public Object getValue()

Description

Returns the value of the item or activity attribute as type Object.

getType

Java Syntax

public String getType()

Description

Returns the data type of the item or activity attribute. See: Attribute Types, Oracle Workflow Developer's Guide.

getFormat

Java Syntax

public String getFormat()

Description

Returns the format string for the item or activity attribute, such as the length for an attribute of type text or the format mask for an attribute of type number or date. See: To Define an Item Type or Activity Attribute, Oracle Workflow Developer's Guide.

getValueType

Java Syntax

public String getValueType()

Description

Returns the type of the default value for the item or activity attribute. The default value can be either a constant or, for an activity attribute, a reference to an item type attribute. See: To Define an Item Type or Activity Attribute, Oracle Workflow Developer's Guide.

toString

Java Syntax

public String toString()

Description

Returns the internal name and the value of the item or activity attribute as a string in the following format:

<name>=<value>

This method overrides the toString() method in the Object class.

compareTo

Java Syntax

public int compareTo
  (String pValue) throws Exception

Description

Compares the value of the item or activity attribute with the specified value. compareTo() returns 0 if the two values are equal, -1 if the attribute value is less than the specified value, or 1 if the attribute value is greater than the specified value.

This method throws an Exception if it cannot convert the specified value to the appropriate format for an attribute of type number or date.

Arguments (input)

Variable Description
pValue The test value to compare to the attribute value.

Workflow Core APIs

PL/SQL procedures called by function activities can use a set of core Oracle Workflow APIs to raise and catch errors.

When a PL/SQL procedure called by a function activity either raises an unhandled exception, or returns a result beginning with 'ERROR:', the Workflow Engine sets the function activity's status to ERROR and sets the columns ERROR_NAME, ERROR_MESSAGE, and ERROR_STACK in the table WF_ITEM_ACTIVITY_STATUSES to reflect the error.

The columns ERROR_NAME and ERROR_MESSAGE get set to either the values returned by a call to WF_CORE.RAISE(), or to the SQL error name and message if no call to RAISE() is found. The column ERROR_STACK gets set to the contents set by a call to WF_CORE.CONTEXT(), regardless of the error source.

Note: The columns ERROR_NAME, ERROR_MESSAGE, and ERROR_STACK are also defined as item type attributes for the System: Error predefined item type. You can reference the information in these columns from the error process that you associate with an activity. See: Error Handling for Workflow Processes, Oracle Workflow Developer's Guide.

Oracle Workflow also provides a core API that lets you substitute HTML character entity references for special characters in a text string, as a security precaution.

The following APIs can be called by an application program or workflow function in the runtime phase to handle error processing. These APIs are stored in the PL/SQL package called WF_CORE.

Related Topics

Standard API for PL/SQL Procedures Called by Function Activities, Oracle Workflow Developer's Guide

CLEAR

Syntax

procedure CLEAR;

Description

Clears the error buffers.

Related Topics

GET_ERROR

GET_ERROR

Syntax

procedure GET_ERROR
  (err_name out varchar2,
   err_message out varchar2
   err_stack out varchar2);

Description

Returns the name of a current error message and the token substituted error message. Also clears the error stack. Returns null if there is no current error.

Sample Code

/* Handle unexpected errors in your workflow code by raising 
 * WF_CORE exceptions.  When calling any public Workflow API, 
 * include an exception handler to deal with unexpected 
 * errors.*/

declare
  errname varchar2(30);
  errmsg varchar2(2000);
  errstack varchar2(32000);

begin
  ...
  Wf_Engine.CompleteActivity(itemtype, itemkey, activity, 
    result_code);
  ...

exception
  when others then
    wf_core.get_error(err_name, err_msg, err_stack);
    if (err_name is not null) then
      wf_core.clear;
      -- Wf error occurred.  Signal error as appropriate.
    else
      -- Not a wf error.  Handle otherwise.
    end if;
end;

Related Topics

CLEAR

TOKEN

Syntax

procedure TOKEN
  (token_name in varchar2,
   token_value in varchar2);

Description

Defines an error token and substitutes it with a value. Calls to TOKEN() and RAISE() raise predefined errors for Oracle Workflow that are stored in the WF_RESOURCES table. The error messages contain tokens that need to be replaced with relevant values when the error message is raised. This is an alternative to raising PL/SQL standard exceptions or custom-defined exceptions.

Arguments (input)

Variable Description
token_name Name of the token.
token_value Value to substitute for the token.

Related Topics

RAISE

CONTEXT

RAISE

Syntax

procedure RAISE
  (name in varchar2);

Description

Raises an exception to the caller by supplying a correct error number and token substituted message for the name of the error message provided.

Calls to TOKEN() and RAISE() raise predefined errors for Oracle Workflow that are stored in the WF_RESOURCES table. The error messages contain tokens that need to be replaced with relevant values when the error message is raised. This is an alternative to raising PL/SQL standard exceptions or custom-defined exceptions.

Error messages for Oracle Workflow are initially defined in message files (.msg). The message files are located in the $FND_TOP/import/<language> directory. During the installation of Oracle Workflow, a program called Workflow Resource Generator takes the designated message files and imports the messages into the WF_RESOURCES table.

Note: If you want to use custom error messages, you can define your messages in .msg files, load them to the WF_RESOURCES table, and then raise them using RAISE(). A custom error message must have an error number of 90000 or higher.

Arguments (input)

Variable Description
name Internal name of the error message as stored in the table WF_RESOURCES.

To run the Workflow Resource Generator:

  1. The Workflow Resource Generator program is registered as a concurrent program. You can run the Workflow Resource Generator (FNDWFRESGEN) concurrent program from the Submit Requests form or from the command line.

  2. To run the concurrent program from the Submit Requests form, navigate to the Submit Requests form.

    Note: Your system administrator needs to add this concurrent program to a request security group for the responsibility that you want to run this program from. See: Overview of Concurrent Programs and Requests, Oracle E-Business Suite System Administrator's Guide - Configuration.

  3. Submit the Workflow Resource Generator concurrent program as a request. See: Running Reports and Programs, Oracle E-Business Suite User's Guide.

  4. In the Parameters window, enter values for the following parameters:

    Variable Description
    Destination Type Specify "Database", to upload seed data to the database table WF_RESOURCES from a source file (.msg), or "File", to generate a resource file from a source file.
    Destination If you specify "File" for Destination Type, then enter the full path and name of the resource file you wish to generate. If you specify "Database" for Destination Type, then the program automatically uses the current database account as its destination.
    Source Specify the full path and name of your source file.
  5. Choose OK to close the Parameters window.

  6. When you finish modifying the print and run options for this request, choose Submit to submit the request.

  7. Rather than use the Submit Requests form, you can also run the Workflow Resource Generator concurrent program from the command line using one of two commands. To generate a resource file from a source file, type:

    WFRESGEN apps/pwd 0 Y FILE res_file source_file
    

    To upload seed data to the database table WF_RESOURCES from a source file, type:

    WFRESGEN apps/pwd 0 Y DATABASE source_file
    

    Replace apps/pwd with the username and password to the APPS schema, replace res_file with the file specification of a resource file, and replace source_file with the file specification of a source file (.msg). A file specification is specified as:

    @<application_short_name>:[<dir>/.../]file.ext
    

    or

    <native path>
    

Related Topics

TOKEN

CONTEXT

CONTEXT

Syntax

procedure CONTEXT
  (pkg_name  IN VARCHAR2,
   proc_name IN VARCHAR2,
   arg1      IN VARCHAR2 DEFAULT '*none*',
   arg2      IN VARCHAR2 DEFAULT '*none*',
   arg3      IN VARCHAR2 DEFAULT '*none*',
   arg4      IN VARCHAR2 DEFAULT '*none*',
   arg5      IN VARCHAR2 DEFAULT '*none*');

Description

Adds an entry to the error stack to provide context information that helps locate the source of an error. Use this procedure with predefined errors raised by calls to TOKEN() and RAISE(), with custom-defined exceptions, or even without exceptions whenever an error condition is detected.

Arguments (input)

Variable Description
pkg_name Name of the procedure package.
proc_name Procedure or function name.
arg1 First IN argument.
argn nth IN argument.

Sample Code

/*PL/SQL procedures called by function activities can use the 
 * WF_CORE APIs to raise and catch errors the same way the 
 * Workflow Engine does. */

package My_Package is

procedure MySubFunction(
  arg1 in varchar2,
  arg2 in varchar2)
is
...
begin
  if (<error condition>) then
    Wf_Core.Token('ARG1', arg1);
    Wf_Core.Token('ARG2', arg2);
    Wf_Core.Raise('ERROR_NAME');
  end if;
  ...

exception
  when others then
    Wf_Core.Context('My_Package', 'MySubFunction', arg1, arg2);
    raise;
end MySubFunction;

procedure MyFunction(
  itemtype in varchar2,
  itemkey in varchar2,
  actid in number,
  funcmode in varchar2,
  result out varchar2)
is
...
begin
  ...
  begin
    MySubFunction(arg1, arg2);
  exception
    when others then
      if (Wf_Core.Error_Name = 'ERROR_NAME') then
        -- This is an error I wish to ignore.
        Wf_Core.Clear;
      else
        raise;
      end if;
   end;
   ...
exception
  when others then
    Wf_Core.Context('My_Package', 'MyFunction', itemtype, itemkey,
                    to_char(actid), funcmode);
    raise;
end MyFunction;

Related Topics

TOKEN

RAISE

TRANSLATE

Syntax

function TRANSLATE
  (tkn_name IN VARCHAR2)
  return VARCHAR2;

Description

Translates the string value of a token by returning the value for the token as defined in WF_RESOURCES for your language setting.

Arguments (input)

Variable Description
tkn_name Token name.

SubstituteSpecialChars

PL/SQL Syntax

function SubstituteSpecialChars
  (some_text in varchar2) 
  return varchar2;

Pragmas

pragma RESTRICT_REFERENCES(SubstituteSpecialChars,WNDS);

Description

Substitutes HTML character entity references for special characters in a text string and returns the modified text including the substitutions.

You can use this function as a security precaution when creating a PL/SQL document or a PL/SQL CLOB document that contains HTML, to ensure that only the HTML code you intend to include is executed. If you retrieve any data from the database at runtime for inclusion in the document, use SubstituteSpecialChars() to replace any HTML tag characters in that data, so that those characters will not be interpreted as HTML code and executed.

Note that you should not substitute entity references for HTML tags that you include in the document yourself. Otherwise, the document will not be displayed with your intended HTML formatting. You only need to perform this substitution for data that is retrieved from the database at runtime, which may be entered from an external source.

The following table shows each special character and the entity reference with which it is replaced.

Entity Reference Replacements for Special Characters
Character Entity Reference
< &lt;
> &gt;
\ &#92;
& &amp;
" &quot;
' &#39;

Arguments (input)

Variable Description
some_text The text string in which you want to replace special characters.

Workflow Purge APIs

The following APIs can be called by an application program or workflow function in the runtime phase to purge obsolete runtime and design data. These APIs are defined in the PL/SQL package called WF_PURGE.

WF_PURGE can be used to purge obsolete runtime data for completed work items, obsolete runtime data not associated with work items, and design information for obsolete activity versions that are no longer in use and expired ad hoc users and roles. You may want to periodically purge this obsolete data from your system to increase performance.

A PL/SQL variable called "persistence_type"in the WF_PURGE package defines how most of the WF_PURGE APIs behave, with the exception of TotalPerm(). When the variable is set to TEMP, the WF_Purge APIs only purge data associated with Temporary item types, whose persistence, in days, has expired. The persistence_type variable is set to TEMP by default and should not be changed. If you need to purge runtime data for item types with Permanent persistence, you should use the procedure TotalPerm(). See: Persistence Type, Oracle Workflow Developer's Guide.

Important: You cannot run any WF_PURGE API for a future end date. By entering a future end date, you may inadvertently violate the persistence period for Temporary item types. The WF_PURGE APIs will display an error message if you enter a future end date.

The three most commonly used procedures are:

The other auxiliary routines purge only certain tables or classes of data, and can be used in circumstances where a full purge is not desired.

The complete list of purge APIs is as follows:

You can also use the "Purge Obsolete Workflow Runtime Data" concurrent program to purge obsolete item type runtime status information. See: Purge Obsolete Workflow Runtime Data.

Related Topics

Standard API for PL/SQL Procedures Called by Function Activities, Oracle Workflow Developer's Guide

Purging for Performance, Oracle Workflow Administrator's Guide

Items

Syntax

procedure Items
  (itemtype in varchar2 default null,
   itemkey in varchar2 default null,
   enddate in date default sysdate, 
   docommit in boolean default TRUE,
   force in boolean default FALSE,
   purgesigs in pls_integer default null);

Description

Deletes all items for the specified item type, item key, and end date, including process status information, notifications, and any comments associated with these notifications. However, to preserve electronic signature evidence for future reference, this API by default does not delete any notifications that required signatures or their associated signature information. If you do not need to maintain signature evidence, you can choose to delete signature-related information as well.

Deletes from the tables WF_NOTIFICATIONS, WF_COMMENTS, WF_ITEM_ACTIVITY_STATUSES, WF_ITEM_ATTRIBUTE_VALUES, and WF_ITEMS, and, if specified, from WF_DIG_SIGS.

Note: Oracle Workflow cannot purge work items that have circular parent/child relationships. That is, if a parent item has a child item that in turn is the parent of another child, and so on, a lower-level item in the parent/child hierarchy cannot be set as the parent of a higher-level item. To purge such items, you must first remove the parent/child relationship by calling WF_ENGINE.SetItemParent with null values for the parent item type and parent item key.

Arguments (input)

Variable Description
itemtype Item type to delete. Leave this argument null to delete all item types.
itemkey A string generated from the application object's primary key. The string uniquely identifies the item within an item type. If null, the procedure purges all items in the specified item type.
enddate Specified date to delete up to.
docommit Specify TRUE or FALSE to indicate whether to commit data while purging. If you want Items() to commit data as it purges to reduce rollback size and improve performance, specify TRUE. If you do not want to perform automatic commits, specify FALSE. Defaults to TRUE.

Note: By default, the procedure commits data after every 1000 records. It then resumes purging work items with the next subsequent begin date. In some cases, if additional items have the same begin date as the last item that was purged before a commit, the procedure may not purge all eligible items. To purge these remaining work items, simply rerun the procedure.

force Specify TRUE or FALSE to indicate whether to delete records for child items that have ended, even if the corresponding parent item does not yet have an end date. Defaults to FALSE.
purgesigs Leave this parameter null to preserve signature evidence, including notifications that required electronic signatures and their associated signature information. Specify 1 to delete signature-related information. Defaults to null.

Activities

Syntax

procedure Activities
  (itemtype in varchar2 default null,
   name in varchar2 default null,
   enddate in date default sysdate);

Description

Deletes old design versions of eligible activities from the tables WF_ACTIVITY_ATTR_VALUES, WF_ACTIVITY_TRANSITIONS, WF_PROCESS_ACTIVITIES, WF_ACTIVITY_ATTRIBUTES_TL, WF_ACTIVITY_ATTRIBUTES, WF_ACTIVITIES_TL, and WF_ACTIVITIES that are associated with the specified item type, have an END_DATE less than or equal to the specified end date, and are not referenced by an existing item as either a process or activity.

Note: You should call Items() before calling Activities() to avoid having obsolete item references prevent obsolete activities from being deleted.

Arguments (input)

Variable Description
itemtype Item type associated with the activities you want to delete. Leave this argument null to delete activities for all item types.
name Internal name of activity to delete. Leave this argument null to delete all activities for the specified item type.
enddate Specified date to delete up to.

Notifications

Syntax

procedure Notifications
  (itemtype in varchar2 default null,
   enddate in date default sysdate,
   docommit in boolean default TRUE,
   purgesigs in pls_integer default null);

Description

Deletes old eligible notifications that are associated with the specified item type, have an END_DATE less than or equal to the specified end date, and are not referenced by an existing item. Any comments associated with these notifications are deleted as well.

However, to preserve electronic signature evidence for future reference, this API by default does not delete any notifications that required signatures or their associated signature information. If you do not need to maintain signature evidence, you can choose to delete signature-related information as well.

Deletes from the tables WF_NOTIFICATIONS, WF_NOTIFICATION_ATTRIBUTES, and WF_COMMENTS, and, if specified, from WF_DIG_SIGS.

You can use this procedure to delete notifications that are not associated with any work item, such as notifications that were sent by calling WF_NOTIFICATION.Send() rather than through a workflow process.

Note: You should call Items() before calling Notifications() to avoid having obsolete item references prevent obsolete notifications from being deleted.

Arguments (input)

Variable Description
itemtype Item type associated with the notifications you want to delete. Leave this argument null to delete notifications for all item types.
enddate Specified date to delete up to.
docommit Specify TRUE or FALSE to indicate whether to commit data while purging. If you want Notifications() to commit data as it purges to reduce rollback size and improve performance, specify TRUE. If you do not want to perform automatic commits, specify FALSE. Defaults to TRUE.
purgesigs Leave this parameter null to preserve signature evidence, including notifications that required electronic signatures and their associated signature information. Specify 1 to delete signature-related information. Defaults to null.

Total

Syntax

procedure Total
  (itemtype in varchar2 default null,
   itemkey in varchar2 default null,
   enddate in date default sysdate, 
   docommit in boolean default TRUE,
   runtimeonly in boolean default null,
   purgesigs in pls_integer default null);

Description

Deletes all eligible obsolete runtime item type data that is associated with the specified item type and has an END_DATE less than or equal to the specified end date. If the ECX: Purge ECX data with WF profile option is set to Y, then this procedure also deletes any Oracle XML Gateway transaction information associated with the items being purged.

However, to preserve electronic signature evidence for future reference, this procedure by default does not delete any notifications that required signatures or their associated signature information. If you do not need to maintain signature evidence, you can choose to delete signature-related information as well.

If the runtimeonly parameter is set to TRUE or left null, Total() deletes only runtime data associated with work items. However, if the runtimeonly parameter is set to FALSE, Total() also deletes these types of data:

Because Total() purges additional design data and runtime data not associated with work items when you set the runtimeonly parameter to FALSE, it is more costly in performance than Items(). If you want to purge a specific item key, use Items(), or set the runtimeonly parameter to TRUE when you run Total() to enhance performance. Run Total() with the runtimeonly parameter set to FALSE as part of your routine maintenance during periods of low activity. See: Items.

Arguments (input)

Variable Description
itemtype Item type associated with the obsolete data you want to delete. Leave this argument null to delete obsolete data for all item types.
itemkey A string generated from the application object's primary key. The string uniquely identifies the item within an item type. If null, the procedure purges all items in the specified itemtype.
enddate Specified date to delete up to.
docommit Specify TRUE or FALSE to indicate whether to commit data while purging. If you want Total() to commit data as it purges to reduce rollback size and improve performance, specify TRUE. If you do not want to perform automatic commits, specify FALSE. Defaults to TRUE.

Note: By default, the procedure commits data after every 1000 records. It then resumes purging work items with the next subsequent begin date. In some cases, if additional items have the same begin date as the last item that was purged before a commit, the procedure may not purge all eligible items. To purge these remaining work items, simply rerun the procedure.

runtimeonly Specify TRUE to purge only obsolete runtime data associated with work items, or FALSE to purge all obsolete runtime data as well obsolete design data. Defaults to null, which is treated as a value of TRUE.
purgesigs Leave this parameter null to preserve signature evidence, including notifications that required electronic signatures and their associated signature information. Specify 1 to delete signature-related information. Defaults to null.

TotalPERM

Syntax

procedure TotalPERM
  (itemtype in varchar2 default null,
   itemkey in varchar2 default null,
   enddate in date default sysdate, 
   docommit in boolean default TRUE,
   runtimeonly in boolean default null,
   purgesigs in pls_integer default null);

Description

Deletes all eligible obsolete runtime data that is of persistence type 'PERM' (Permanent) and that is associated with the specified item type and has an END_DATE less than or equal to the specified end date. If the ECX: Purge ECX data with WF profile option is set to Y, then this procedure also deletes any Oracle XML Gateway transaction information associated with the items being purged.

However, to preserve electronic signature evidence for future reference, this procedure by default does not delete any notifications that required signatures or their associated signature information. If you do not need to maintain signature evidence, you can choose to delete signature-related information as well.

If the runtimeonly parameter is set to TRUE or left null, TotalPERM() deletes only runtime data associated with work items. However, if the runtimeonly parameter is set to FALSE, TotalPERM() also deletes these types of data:

TotalPERM() is similar to Total() except that TotalPERM() deletes only items with a persistence type of 'PERM'. See: Total.

Arguments (input)

Variable Description
itemtype Item type associated with the obsolete runtime data you want to delete. Leave this argument null to delete obsolete runtime data for all item types.
itemkey A string generated from the application object's primary key. The string uniquely identifies the item within an item type. If null, the procedure purges all items in the specified itemtype.
enddate Specified date to delete up to.
docommit Specify TRUE or FALSE to indicate whether to commit data while purging. If you want TotalPERM() to commit data as it purges to reduce rollback size and improve performance, specify TRUE. If you do not want to perform automatic commits, specify FALSE. Defaults to TRUE.

Note: By default, the procedure commits data after every 1000 records. It then resumes purging work items with the next subsequent begin date. In some cases, if additional items have the same begin date as the last item that was purged before a commit, the procedure may not purge all eligible items. To purge these remaining work items, simply rerun the procedure.

runtimeonly Specify TRUE to purge only obsolete runtime data associated with work items, or FALSE to purge all obsolete runtime data as well obsolete design data. Defaults to null, which is treated as a value of TRUE.
purgesigs Leave this parameter null to preserve signature evidence, including notifications that required electronic signatures and their associated signature information. Specify 1 to delete signature-related information. Defaults to null.

Directory

Syntax

procedure Directory
   (end_date in date default sysdate);

Description

Purges all ad hoc users and roles in the WF_LOCAL_ROLES and WF_LOCAL_USER_ROLES tables whose expiration date is less than or equal to the specified end date and that are not referenced in any notification.

Note that although ad hoc users and roles whose expiration date has passed do not appear in the seeded WF_USERS, WF_ROLES, and WF_USER_ROLES views, they are not removed from the Workflow local tables until you purge them using Directory(). You should periodically purge expired ad hoc users and roles in order to improve performance.

Note: This API does not delete ad hoc users or roles whose expiration date is null. To ensure that ad hoc users and roles are purged in a timely fashion after they are no longer needed, estimate how long they should be active and specify an appropriate expiration date when you call WF_DIRECTORY.CreateAdHocUser(), WF_DIRECTORY.CreateAdHocRole(), or WF_DIRECTORY.CreateAdHocRole2() to create them.

Arguments (input)

Variable Description
end_date Date to purge to.

Purge Obsolete Workflow Runtime Data Concurrent Program

You can submit the Purge Obsolete Workflow Runtime Data concurrent program to purge obsolete runtime work item information, including status information, any associated notifications, and, if the ECX: Purge ECX data with WF profile option is set to Y, any associated Oracle XML Gateway transactions. Use the Submit Requests form in Oracle E-Business Suite to submit this concurrent program.

By default, this program purges obsolete runtime information associated with work items as well as obsolete design information, such as activities that are no longer in use and expired ad hoc users and roles, and obsolete runtime information not associated with work items, such as notifications that were not handled through a workflow process and, if the ECX: Purge ECX data with WF profile option is set to Y, Oracle XML Gateway transactions that were not handled through a workflow process. You can optionally choose to purge only core runtime information associated with work items for performance gain during periods of high activity, and purge all obsolete information as part of your routine maintenance during periods of low activity.

To preserve electronic signature evidence for future reference, this program by default does not delete any notifications that required signatures or their associated signature information. If you do not need to maintain signature evidence, you can choose to delete signature-related information as well.

Note: This program does not delete ad hoc users or roles whose expiration date is null. To ensure that ad hoc users and roles are purged in a timely fashion after they are no longer needed, estimate how long they should be active and specify an appropriate expiration date when you call WF_DIRECTORY.CreateAdHocUser(), WF_DIRECTORY.CreateAdHocRole(), or WF_DIRECTORY.CreateAdHocRole2() to create them.

Note: You can also use the Oracle Workflow Manager component of Oracle Applications Manager to submit and manage the Purge Obsolete Workflow Runtime Data concurrent program. See: Purging Workflow Data, Oracle Workflow Administrator's Guide.

Additionally, you can use the Purge Obsolete ECX Data concurrent program to purge Oracle XML Gateway transactions according to Oracle XML Gateway-specific parameters. For information about this program and about the ECX: Purge ECX data with WF profile option, see: Purge Obsolete ECX Data Concurrent Program, Oracle XML Gateway User's Guide and Purge Obsolete Workflow Runtime Data Concurrent Program, Oracle XML Gateway User's Guide.

To Purge Obsolete Workflow Runtime Data:

  1. Navigate to the Submit Requests form in Oracle E-Business Suite to submit the Purge Obsolete Workflow Runtime Data concurrent program. When you install and set up Oracle E-Business Suite and Oracle Workflow, your system administrator needs to add this concurrent program to a request security group for the responsibility that you want to run this program from. The executable name for this concurrent program is "Oracle Workflow Purge Obsolete Data" and its short name is FNDWFPR. See: Overview of Concurrent Programs and Requests, Oracle E-Business Suite System Administrator's Guide - Configuration.

  2. Submit the Purge Obsolete Workflow Runtime Data concurrent program as a request. See: Running Reports and Programs, Oracle E-Business Suite User's Guide.

  3. In the Parameters window, enter values for the following parameters:

    Variable Description
    Item Type Item type associated with the obsolete runtime data you want to delete. Leave this argument null to delete obsolete runtime data for all item types.
    Item Key A string generated from the application object's primary key. The string uniquely identifies the item within an item type. If null, the program purges all items in the specified item type.
    Age Minimum age of data to purge, in days, if the persistence type is set to 'Temporary'. The default is 0.
    Persistence Type Persistence type to be purged, either 'Temporary' or 'Permanent'. The default is 'Temporary'.
    Core Workflow Only Enter 'Y' to purge only obsolete runtime data associated with work items, or 'N' to purge all obsolete runtime data as well obsolete design data. The default is 'N'.
    Commit Frequency The number of records to purge before the program commits data. To reduce rollback size and improve performance, set this parameter to commit data after a smaller number of records. The default is 500 records.

    Note: After performing a commit, the program resumes purging work items with the next subsequent begin date. In some cases, if additional items have the same begin date as the last item that was purged before a commit, the program may not purge all eligible items. To purge these remaining work items, simply rerun the program.

    Signed Notifications Enter 'N' to preserve signature evidence, including notifications that required electronic signatures and their associated signature information. Enter 'Y' to purge signature-related information. The default is 'N'.
  4. Choose OK to close the Parameters window.

  5. When you finish modifying the print and run options for this request, choose Submit to submit the request.

Workflow Monitor APIs

Call the following APIs to retrieve an access key or to generate a complete URL to access various pages of the administrator version of the Status Monitor with guest access. The Workflow Monitor APIs are defined in the PL/SQL package called WF_MONITOR.

Note: The GetURL API from earlier versions of Oracle Workflow is replaced by the GetEnvelopeURL and GetDiagramURL APIs. The functionality of the previous GetURL API correlates directly with the new GetDiagramURL. API. The current version of Oracle Workflow still recognizes the GetURL API, but moving forward, you should only use the two new APIs where appropriate.

Note: Oracle Workflow also provides Java methods for accessing the Status Monitor which are defined in the Java class called oracle.apps.fnd.wf.monitor.webui.Monitor.

Related Topics

Providing Access to the Status Monitor from Applications, Oracle Workflow Administrator's Guide

Guest Access in PL/SQL, Oracle Workflow Administrator's Guide

GetAccessKey

Syntax

function GetAccessKey
  (x_item_type varchar2,
   x_item_key varchar2,
   x_admin_mode varchar2)
  return varchar2;

Description

Retrieves the access key password that controls access to the Workflow Monitor. Each process instance has separate access keys for running the Workflow Monitor in 'ADMIN' mode or 'USER' mode.

Arguments (input)

Variable Description
x_item_type A valid item type.
x_item_key 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 to report on.
x_admin_mode A value of YES or NO. YES directs the function to retrieve the access key password that runs the monitor in 'ADMIN' mode. NO retrieves the access key password that runs the monitor in 'USER' mode.

GetDiagramURL

Syntax

function GetDiagramURL
  (x_agent in varchar2,
   x_item_type in varchar2,
   x_item_key in varchar2,
   x_admin_mode in varchar2 default 'NO')
  return varchar2;

Description

Can be called by an application to return a URL that allows access to the Status Diagram page in the Status Monitor with guest access. The URL displays the Status Diagram page for a specific instance of a workflow process in the administrator version of the Status Monitor, operating either with or without administrator privileges.

Arguments (input)

Variable Description
x_agent This parameter is no longer used. Set this parameter to null.
x_item_type A valid item type.
x_item_key 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 to report on.
x_admin_mode A value of YES or NO. YES directs the function to grant administrator privileges to the user accessing the Status Monitor. NO directs the function to withhold administrator privileges from the user accessing the Status Monitor.

Sample Code

Following is an example of how you can call GetDiagramUrl(). This example returns a URL that displays the diagram page for a process instance identified by the item type WFDEMO and item key 10022, in 'USER' mode or without administrator privileges:

URL := WF_MONITOR.GetDiagramURL
  (null,
   'WFDEMO',
   '10022', 
   'NO');

GetEnvelopeURL

Syntax

function GetEnvelopeURL
  (x_agent in varchar2,
   x_item_type in varchar2,
   x_item_key in varchar2,
   x_admin_mode in varchar2 default 'NO')
  return varchar2;

Description

Can be called by an application to return a URL that allows access to the Monitor Responses page in the Status Monitor with guest access. The URL displays the Monitor Responses page for a specific instance of a workflow process in the administrator version of the Status Monitor, operating either with or without administrator privileges.

Arguments (input)

Variable Description
x_agent This parameter is no longer used. Set this parameter to null.
x_item_type A valid item type.
x_item_key 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 to report on.
x_admin_mode A value of YES or NO. YES directs the function to grant administrator privileges to the user accessing the Status Monitor. NO directs the function to withhold administrator privileges from the user accessing the Status Monitor.

GetAdvancedEnvelopeURL

Syntax

function GetAdvancedEnvelopeURL
  (x_agent in varchar2,
   x_item_type in varchar2,
   x_item_key in varchar2,
   x_admin_mode in varchar2 default 'NO',
   x_options in varchar2 default null)
  return varchar2;

Description

Can be called by an application to return a URL that allows access to the Activity History page in the Status Monitor with guest access. The URL displays the Activity History page for a specific instance of a workflow process in the administrator version of the Status Monitor, operating either with or without administrator privileges. All activity type and activity status filtering options are automatically selected by default.

Arguments (input)

Variable Description
x_agent This parameter is no longer used. Set this parameter to null.
x_item_type A valid item type.
x_item_key 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 to report on.
x_admin_mode A value of YES or NO. YES directs the function to grant administrator privileges to the user accessing the Status Monitor. NO directs the function to withhold administrator privileges from the user accessing the Status Monitor.
x_options This parameter is no longer used. When you access the Status Monitor with a URL from GetAdvancedEnvelopeURL(), all filtering options are always selected by default.

Workflow Status Monitor APIs

Call the following APIs to retrieve parameters for use with the self-service functions that provide access to the Status Monitor from Oracle E-Business Suite forms. You can use these APIs to help integrate other applications with the Status Monitor.

The Workflow Status Monitor PL/SQL APIs are defined in the PL/SQL package called WF_FWKMON.

Related Topics

Providing Access to the Status Monitor from Applications, Oracle Workflow Administrator's Guide

Guest Access from Oracle E-Business Suite Forms, Oracle Workflow Administrator's Guide

GetEncryptedAccessKey

PL/SQL Syntax

function GetEncryptedAccessKey
  (itemType in varchar2,
   itemKey in varchar2,
   adminMode in varchar2 default 'N')
  return varchar2;

Description

Returns an encrypted access key password that controls access to the specified workflow process instance in the Status Monitor with the specified administrator mode. The administrator mode lets you determine whether the user who accesses the Status Monitor with this access key should have privileges to perform administrative operations in the Status Monitor.

Arguments (input)

Variable Description
itemType A valid workflow 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 workflow process.
adminMode Specify 'Y' to grant administrator privileges to the user accessing the Status Monitor, or 'N' to withhold administrator privileges from the user. The default is 'N'.

GetEncryptedAdminMode

PL/SQL Syntax

function GetEncryptedAdminMode
  (adminMode in varchar2)
  return varchar2;

Description

Returns an encrypted value for the specified administrator mode. The administrator mode lets you determine whether a user accessing the Status Monitor should have privileges to perform administrative operations in the Status Monitor.

Arguments (input)

Variable Description
adminMode Specify 'Y' to grant administrator privileges to the user accessing the Status Monitor, or 'N' to withhold administrator privileges from the user. The default is 'N'.

IsMonitorAdministrator

PL/SQL Syntax

function IsMonitorAdministrator
  (userName in varchar2)
  return varchar2;

Description

Returns 'Y' if the specified user has workflow administrator privileges, or 'N' if the specified user does not have workflow administrator privileges. Workflow administrator privileges are assigned in the Workflow Configuration page. See: Setting Global User Preferences, Oracle Workflow Administrator's Guide.

For example, you can use this function to help determine what administrator mode to choose when calling GetEncryptedAccesKey() or GetEncryptedAdminMode() to retrieve parameters for use with the Status Monitor form functions.

Arguments (input)

Variable Description
userName A valid user name.

Oracle Workflow Views

Public views are available for accessing workflow data. These views are installed in the APPS account.

Note: These database views are public, meaning they are available for you to use for your custom data requirements. This description does not mean that any privileges for these views have been granted to PUBLIC.

WF_ITEM_ACTIVITY_STATUSES_V

This view contains denormalized information about a workflow process and its activities' statuses. Use this view to create custom queries and reports on the status of a particular item or process.

The following table describes the columns of the view.

WF_ITEM_ACTIVITY_STATUSES_V Columns
Name Null? Type
ROWID   ROWID
SOURCE   CHAR(1)
ITEM_TYPE   VARCHAR2(8)
ITEM_TYPE_DISPLAY_NAME   VARCHAR2(80)
ITEM_TYPE_DESCRIPTION   VARCHAR2(240)
ITEM_KEY   VARCHAR2(240)
USER_KEY   VARCHAR2(240)
ITEM_BEGIN_DATE   DATE
ITEM_END_DATE   DATE
ACTIVITY_ID   NUMBER
ACTIVITY_LABEL   VARCHAR2(30)
ACTIVITY_NAME   VARCHAR2(30)
ACTIVITY_DISPLAY_NAME   VARCHAR2(80)
ACTIVITY_DESCRIPTION   VARCHAR2(240)
ACTIVITY_TYPE_CODE   VARCHAR2(8)
ACTIVITY_TYPE_DISPLAY_NAME   VARCHAR2(80)
EXECUTION_TIME   NUMBER
ACTIVITY_BEGIN_DATE   DATE
ACTIVITY_END_DATE   DATE
ACTIVITY_STATUS_CODE   VARCHAR2(8)
ACTIVITY_STATUS_DISPLAY_NAME   VARCHAR2(80)
ACTIVITY_RESULT_CODE   VARCHAR2(30)
ACTIVITY_RESULT_DISPLAY_NAME   VARCHAR2(4000)
ASSIGNED_USER   VARCHAR2(30)
ASSIGNED_USER_DISPLAY_NAME   VARCHAR2(4000)
NOTIFICATION_ID   NUMBER
OUTBOUND_QUEUE_ID   RAW(16)
ERROR_NAME   VARCHAR2(30)
ERROR_MESSAGE   VARCHAR2(2000)
ERROR_STACK   VARCHAR2(4000)

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

WF_NOTIFICATION_ATTR_RESP_V

This view contains information about the Respond message attributes for a notification group. If you plan to create a custom voting activity, use this view to create the function that tallies the responses from the users in the notification group. See: Voting Activity, Oracle Workflow Developer's Guide.

The following table describes the columns of the view.

WF_NOTIFICATION_ATTR_RESP_V Columns
Name Null? Type
GROUP_ID NOT NULL NUMBER
RECIPIENT_ROLE NOT NULL VARCHAR2(30)
RECIPIENT_ROLE_DISPLAY_NAME   VARCHAR2(4000)
ATTRIBUTE_NAME NOT NULL VARCHAR2(30)
ATTRIBUTE_DISPLAY_NAME NOT NULL VARCHAR2(80)
ATTRIBUTE_VALUE   VARCHAR2(2000)
ATTRIBUTE_DISPLAY_VALUE   VARCHAR2(4000)
MESSAGE_TYPE NOT NULL VARCHAR2(8)
MESSAGE_NAME NOT NULL VARCHAR2(30)

WF_RUNNABLE_PROCESSES_V

This view contains a list of all runnable workflow processes in the ACTIVITIES table.

The following table describes the columns of the view.

WF_RUNNABLE_PROCESSES_V Columns
Name Null? Type
ITEM_TYPE NOT NULL VARCHAR2(8)
PROCESS_NAME NOT NULL VARCHAR2(30)
DISPLAY_NAME NOT NULL VARCHAR2(80)

WF_ITEMS_V

This view is a select-only version of the WF_ITEMS table.

The following table describes the columns of the view.

WF_ITEMS_V Columns
Name Null? Type
ITEM_TYPE NOT NULL VARCHAR2(8)
ITEM_KEY NOT NULL VARCHAR2(240)
USER_KEY   VARCHAR2(240)
ROOT_ACTIVITY NOT NULL VARCHAR2(30)
ROOT_ACTIVITY_VERSION NOT NULL NUMBER
OWNER_ROLE   VARCHAR2(30)
PARENT_ITEM_TYPE   VARCHAR2(8)
PARENT_ITEM_KEY   VARCHAR2(240)
PARENT_CONTEXT   VARCHAR2(2000)
BEGIN_DATE NOT NULL DATE
END_DATE   DATE

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