You are on page 1of 17

Deferred Workflow Context Issues

Collaborate07 Sunday April 15, 2:15 4:30 Lagoon H

Deferred Workflow Context Issues


Issue Summary Oracle Database Session Context Item Type Selector Order Management Example

Issue Summary
This presentation is follow up on an Oracle EBusiness Suite Workflow issue reported by several WF SIG members at the last WF SIG meeting at Oracle OpenWorld.

Oracle Workflows were reported to:


Not updating records with the correct Row Who data Some customizations dont seem to have the Operating Unit (ORG_ID) set properly

Oracle Database Session Context

There are two primary groups of data:


Row Who Data Set using:
FND_GLOBAL.Apps_Initialize(l_user_id, l_resp_id, l_resp_appl_id);

Operating Unit (ORG_ID) Set using:


FND_CLIENT_INFO.Set_Org_Context(to_char(l_org_id));

How is Database Session Info Set

If the workflow is running in real time (non-deferred mode) then the database session info is inherited from the users database session.
The workflow is running in this users database session.

Deferred Workflows DB Session


Deferred workflows are run by the Workflow Background Process. The Workflow Background Processes run many different Item Type Processes for many different users and operating units. So how is this suppose to work.

Item Type Selector


On the Item Type Properties form there is a field for Selector.

Workflow Development Guide

Developers Guide, Release 2.6.3,Part No. B1028402 Page 3-5, Item Type Selector Function
Used to: Auto select the runnable process for a given Item Type As a Call Back function to set database session context for deferred activities Page 6-13, Standard API for an Item Type Selector or Callback Function

How does this work


Oracle Workflow calls the selector/callback function with the following commands: RUN: to select the appropriate process to start TEST_CTX: to determine if the current item type context information is correct before executing a function SET_CTX: to establish any context information for an item type and item key combination that a function activity in the item type needs in order to execute. Automatically during switches in Item Type/Item Key.

RUN
This mode returns the Item Types process name to be run

TEST_CTX
The Selector Function is first called in this mode. It is the developers responsibility to determine if the database session info is set correctly If the database session is set correctly return TRUE If the database session is not set correctly return FALSE The call Selector Function in SET_CTX mode

SET_CTX
It is the developers responsibility to correctly set the database session information. The ideal situation is to store session context information in Workflow Attributes. Some modules derive the session context from the source document, (ie. Order Header, Requisition Header, etc.). Again it is up to the development team to decide how/when to do this

Order Management
The selector functions are: Header = OE_STANDARD_WF.OEOH_SELECTOR Line = OE_STANDARD_WF.OEOL_SELECTOR
Within these functions there are if statements which will avoid setting the database session unless the PL/SQL global variable, OE_STANDARD_WF.G_RESET_APPS_CONTEXT is set to true.

Order Management

(cont)

The selector functions are: Header = OE_STANDARD_WF.OEOH_SELECTOR Line = OE_STANDARD_WF.OEOL_SELECTOR


Within these functions there are if statements which will avoid setting the database session unless the PL/SQL global variable, OE_STANDARD_WF.G_RESET_APPS_CONTEXT is set to true.

Order Management

(cont)

I have not found exactly how this global variable is being set. However, Oracle Support did say that the Row Who data will not be correct unless the Workflow Background Process is run individually for each of the OM Item Types: OEOH & OEOL
That is impractical at most sites since the there are 50-100 active Item Types, each would require their own Workflow Background Process.

Order Management

(cont)

ER 5303011 workflow background process not setting last_updated_by to correct user


ER 4060422 request workflow background process can be run with category ranges

Order Management

Summary

In summary, dont rely on the database context information being set properly on deferred OM Workflow Processes This translates into inaccurate Row Who data in OM Warn your auditors that this is a known Oracle E-Business Suite deficiency

You might also like