Thursday Sep 18, 2014

Business event does not raise - event raises and does nothing

Frequently, new functionality is created using the Business Event System or existing functionality is changed by adding new subscriptions, changing subscription phases, changing underlying java or PLSQL code, etc, and inexplicably it is found that raising the business event does not produce the desired result, as if the event was not raised.

The execution of an event consists basically of two parts: raising the event and do all required validation, and then finding the subscriptions to that event and execute them. The first one barely ever fails while the second one is more pron to issues and it is the one that we are mostly interested in as it has the code/behavior we want to see.

The following steps will allow to identify the actual cause of the issue by making use of the FND debugging options provided in EBS.

1. Adjust the subscription phase

Since subscriptions with phase higher than 100 are deferred you would need to raise the event on one session and then go to another session and debug it. It is easier if you can set the phase to a value lower than 100, say 99, and then raise the event in the session. This way you will be able to see everything the happens related to this event subscription, a nothing else.

Remember to ensure that the business event has an error subscription so that if something happens it does not go silent. By adding an ERROR subscription the system administrator would be able to see as notification explaining any failures. See here for more on error subscription definitions. 

2. Raise the event

Do so either from the application or from java or PLSQL. Here is an example from PLSQL.

Note: you can make use of wf_log_pkg.init to enable the FND: Debug option for this session only, so there is no need to change the corresponding profile options. The last parameter ('wf%') means the debug is enabled for the WF code, which the BES belongs to.

  l_parameters wf_parameter_list_t := wf_parameter_list_t();
  --execute immediate 'truncate table applsys.fnd_log_messages';
  --Add your parameters here
  wf_log_pkg.init(1, null, 1, 'wf%');
  wf_event.addparametertolist(p_name          => 'NOTIFICATION_ID',
                              p_value         => '123',
                              p_parameterlist => l_parameters);
  wf_event.raise(p_event_name => '',
                 p_event_key  => '123',
                 p_event_data => NULL,
                 p_parameters => l_parameters,
                 p_send_date  => sysdate);

anonymous block completed 

3. Find the logging details 

Now, within the same session check the log messages generated by the Business Event System:

SELECT 'Level: '||log_level||
       ' Module: '||module||
       ' Time: '||to_char(timestamp, 'DD-MON-RR HH24:MI:SS')||
       '>>> Message: '||message_text
FROM   fnd_log_messages
WHERE  audsid  =  sys_context('userenv', 'SESSIONID')
ORDER BY log_sequence



The final lines found in the query above and the error notifications sent to the system administrator will point out to the error causing the event to look as it did not fire.

Wednesday Aug 06, 2014

Now Available: Oracle Mobile Approvals for iOS


Oracle Mobile Approvals for Oracle E-Business Suite lets you respond on-the-go to your pending approval requests. From your phone, anywhere and anytime, take quick action on approval requests for expenses, requisitions, purchase orders, recruitment vacancies and offers, and more.

- Quickly filter approval requests by sender or subject
- Review at a glance header and line item details, action history, and comments
- Approve or reject with or without comments, or request more information

Oracle Mobile Approvals for Oracle E-Business Suite is compatible with Oracle E-Business Suite 12.1.3 and 12.2.3 and above. To use this app, you must be a user of Oracle E-Business Suite, with mobile services configured on the server side by your administrator.



Oracle Mobile Approvals for Oracle E-Business Suite 1.0.0 is available on Apple's iTunes Store  for download.

This app works against Oracle E-Business Suite Release 12.1.3 and above and 12.2.3 and above.


Oracle Mobile Approvals requires set up on Oracle E-Business Suite instance to support connections from the mobile app. Following patches are required to be applied.


Additional Resources

Friday Aug 16, 2013

Understanding Workflow Errors - Part 2

This post is a follow up to Understanding Workflow Errors - Part 1 that deals with some of the most common errors raised when some of the Workflow Engine APIs are used. 

The way to trap and continue processing upon finding these errors is the same: evaluate the content of global variable WF_CORE.error_name.

Error message: 3103 Attribute 'ATTRIBUTE' does not exist for item 'TYPE/KEY'


The most likely reason for this to happen is a change in the Workflow definition. For instance, an attribute is added to the definition while there are open workflows  not having it. Then you attempt to set a value for it and notice new processes have no issues but the ones created before the change will fail.

Whenever possible these regressions should be foreseen and addressed in the design of the Workflow definition. A possible workaround is to add the supporting plsql code to check for the exception:

    if WF_CORE.error_name='WFENG_ITEM_ATTR' then
    end if;

Error message: 3120 Activity 'TYPE/ACTID' has no performer


All performers of notification activities are taken from view WF_ROLES. The most typical reason for this error is the originally assigned user/role has been expired. While the correct fix is to unexpire the performer and let the workflow complete, there are two possible ways to go around:

1. Change the value to the attribute holding the name of the performer. For instance, if there is an item attribute RECIPIENT pointing to expired user JSMITH then change it to an active user/role, say JHOPKINS. You will need to call this from a SQL*Plus session:

   WF_ENGINE.SetItemAttrText(<type>, <key>, 'RECIPIENT', 'JHOPKINS');

2. The other alternative is to change all references in ALL the workflow runtime tables to change anything related to JSMITH and change it to the taking over user JHOPKINS:

  l_attributes wf_parameter_list_t;
  WF_EVENT.AddParameterToList('OLD_USER_NAME', 'JSMITH', l_attributes);
  WF_EVENT.AddParameterToList('USER_NAME', 'JHOPKINS', l_attributes);
  WF_LOCAL_SYNCH.Propagate_Role(p_orig_system    => <orig system>, --for instance, 'FND_USR' or 'PER'
                                p_orig_system_id => l_orig_system_id, --for instance, 29984
                                p_attributes     => l_attributes);

As always, use care and try these APIs on a test environment before using them in production

Error message: 3133 Activity instance 'NAME' is not a notified activity for item 'TYPE/KEY'.


When it is needed that the processing of a workflow stops to wait for something to happen a BLOCK function can be used. When the block function runs the activity goes into NOTIFIED status. Then, to resume the processing, an explicit call to WF_ENGINE.CompleteActivity must be made. But if the activity is not in notified status then the API will raise WFENG_NOT_NOTIFIED.

There is no straightforward action to deal with this error. Rather, troubleshooting must be made to see why the activity did not go into NOTIFIED status. Sometimes the reason is that the workflow process continued to the next activity, leaving it complete or did not even reach it. A good way to understand what the workflow process has done is to run the seeded script wfstat.sql. Check the output and follow the execution path.

Friday Apr 12, 2013

Understanding Workflow Errors - Part 1

Workflow Engine and other public APIs throw a variety of user-defined exceptions to indicate specific Engine conditions. It is important that Workflow Developers and Administrators understand the meaning of these errors and know how to deal with them. In this post, we will cover some of the important Workflow Engine related errors and understand how to deal with them.

Engine Errors

3122: Duplicate item 'ITEM_TYPE/ITEM_KEY' could not be created


Cause: This error may be thrown from WF_ENGINE.CreateProcess when you attempt to create a new instance of a workflow item. This error indicates that the Item Type and Item Key combination you have used to launch a new workflow instance already exists.

Fix: Use an unique item key for that item type

3136: Item 'ITEM_TYPE/ITEM_KEY' cannot be accessed while synchronous process in progress.


Cause: This error may be thrown from WF_ENGINE.CreateProcess when attempt to create a new synchronous workflow instance while another synchronous workflow  instance is already running in the same session. All synchronous workflow instances are created with item key #SYNCH to make sure the workflow instances starts and completes in the same session.

Fix: Wait till the existing synchronous workflow instance completes before creating another one.

3146: Commit happened in activity/function 'ACTIVITY/FUNCTION'


Cause: While a workflow instance was executing, a commit was issued inside a PLSQL procedure associated to a workflow function activity before or after an error occurred in that PLSQL procedure. 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. 

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

How to Catch these Errors?

Each error above is associated to an Error Code. Within your PLSQL code, you should following method to capture the specific error based on the error code to act on it.

   Wf_Engine.CreateProcess('ITEM_TYPE', 'ITEM_KEY', 'PROCESS_NAME');
    when others then
if (wf_core.error_name = 'WFENG_ITEM_UNIQUE') then
        -- Item already exists, use a unique item key
        Wf_Engine.CreateProcess('ITEM_TYPE', 'ITEM_KEY', 'PROCESS_NAME');
      end if;

Thursday Jan 17, 2013

Oracle Workflow - E-Business Suite vs Standalone

Oracle Workflow has following components that together provide business process management capabilities.

  • Workflow Builder - Windows desktop tool to create and customize workflow processes
  • Workflow Loader - Commandline tool to load workflow definition to database
  • Workflow Engine - PLSQL engine to execute workflow processes definitions
  • Workflow Notification Mailer - Background program to send e-mail notifications
  • Workflow Business Event System - PLSQL and Java based engine to process business events
  • Workflow Agent Listeners - Background program to process business events

Oracle Workflow has been available in two flavors until about 2007.

  1. Workflow Embedded in E-Business Suite
  2. Workflow Standalone

This post is aimed at clarifying how Oracle Workflow in E-Business Suite and Standalone were versioned and the current status of these two flavors.

Workflow Embedded in E-Business Suite

In E-Business Suite, Oracle Workflow is an integral part of foundation modules (FND) alongside Profiles, Concurrent Programs, OA Framework and so on and is shipped in ATG patchsets. For example, Workflow's Java classes are available under $JAVA_TOP like any other FND module, it's PLSQL packages are compiled into APPS schema, datamodel is available under APPLSYS schema and so on. This flavor is also called Embedded Workflow, meaning it was embedded in E-Business Suite.


Embedded Workflow's packaging, release, installation and configuration follows standard E-Business suite's processes. Embedded Workflow is  not identified with it's own version in E-Business Suite, instead it's codelevel is always identified using the current ATG Patchset level.

For example, if a Customer is on E-Business Suite Release 12.1.3, then their Workflow codelevel is R12.ATG_PF.B.Delta.3 (in addition to any Workflow specific one-offs that may have applied on the baseline) which is a standard way of identifying any FND module.

Current Status

Oracle Workflow embedded in E-Business Suite has the same lifetime as the ATG Patchset in that Oracle E-Business Suite. For example, if a Customer is on Oracle E-Business Suite 12.1.3, the workflow module being integral part of Oracle E-Business Suite installation, has no different lifetime or support policy than the R12.ATG_PF.B Patchset. When looking at Oracle Workflow module from E-Business Suite standpoint, it should not be viewed as a separate product rather at the ATG Patchset level.

For more information please refer to 

Workflow Standalone

All of Oracle Workflow's sub-components and the underlying data model were packaged, released, installed and configured completely independent of E-Business Suite until about late 2007.  A Workflow Standalone installation results in a special database schema like OWF_MGR specific to workflow alone unlike the standard APPS and APPLSYS schemas of E-Business Suite.

Oracle Workflow Standalone however was not shipped on it's own but using following release vehicles.

  • Oracle Database - Upto 10gR2
  • Oracle iAS - Upto 10.1.2
  • Oracle Warehouse Builder - Still packaged with OWB 11g

Oracle Workflow standalone product was available as part of above product offerings which helped non-E-Business Suite Customers to have Workflow (Business Process Management) capabilities such as implementing custom approval flows, document approval routing, sending notifications and so on.


Workflow Standalone had it's own versioning mechanism that was completely unrelated to E-Business Suite's. For example, following were some of the recent verisons.

  • Oracle Database 10gR2 - Oracle Workflow 2.6.4
  • Oracle iAS 10.1.2 - Oracle Workflow
  • Oracle iAS 9.0.4 - Oracle Workflow 2.6.3

Current Status

With the advent of better Business Process Execution standards and tools, Oracle Workflow was ceased to be shipped with Oracle Database and Oracle iAS. Oracle BPEL Process Manager (in Oracle SOA Suite 10g) and Oracle SOA Suite 11g are the recommended technologies to be considered by Customers who were using Oracle Workflow Standalone to implement their business processes.

To this effect, MOS Doc 391546.1 was published to announce obsolescence of Workflow Standalone with Oracle Database 10gR2 as the terminal release vehicle for the product. This note applies only to Workflow as a standalone product and does not affect Workflow embedded in E-Business Suite.

Workflow Standalone Obsolescence Notice

MOS Doc 391546.1 clarifies that Workflow as a standalone product will not be shipped in Oracle Database 11g and above. Since Oracle Database 10gR2 is the last release Workflow Standalone was shipped in, existing Oracle Database 10gR2 Customers who also use Workflow Standalone will continue to receive support as per Oracle Database 10gR2 support policies. This obsolescence notice should not be confused with support for Workflow embedded in E-Business Suite.


Oracle Workflow embedded in E-Business Suite is being actively maintained and enhancements implemented based on Customer requirements. We have some exciting days ahead of us for Oracle Workflow embedded in E-Business Suite.

Friday Nov 16, 2012

New Worklist features on 12.1.3

Following new Worklist features are available on E-Business Suite 12.1.3 via Patch 13646173.

Ability to view comments on top of a notification

If an action is performed on a notification such as Reassign, Request for Information or Provide Information, the recipient of the notification will see who performed the last action and the associated comment on top of the notification.

Reassigning a request for information notification

If an approver requests more information on a notification from it's submitter, the submitter now has two options

  1. Answer Request for More Information
  2. Transfer Request for More Information

If the submitter thinks the requested information can be provided by another user, he/she can transfer the request to the other user. Please note that only Transfer is supported for Request for More Information. Once transferred, the submitter cannot access the notification and provide the requested information.

Use actual sent date when reassigning a notification

The Sent field in notification header always showed the date on which the notification was first created. If the notification was later reassigned, the Sent date was not updated to show the last action date. This caused problems in following scenario

  1. Approval notification was sent to JACK on 01-JAN-2012
  2. JACK waited for 10 days before reassigning to JILL on 10-JAN-2012
  3. JILL does not see the notification as sent on 10-JAN-2012, instead sees it as sent on 01-JAN-2012
  4. Although the notification was originally created on 01-JAN-2012, it was sent to JILL only on 10-JAN-2012

The enhancement now shows the correct sent date in Worklist and Notification Details page.

Figure 1 - Depicts all the above 3 features

Related Action History for response required notification

So far it was possible to embed Action History of an response-required notification into another FYI notification using #RELATED_HISTORY attribute (Please refer to Workflow Developer Guide for details about this attribute). The enhancement now enables developers to embed Action History of one response-required notification into another response-required notification.

To embed Action History of one response-required notification into another, create message attribute #RELATED_HISTORY. To this attribute set a value during run-time in the following format.


The TITLE, ITEM_TYPE and ITEM_KEY are optional values.

  1. TITLE is used as Related Action History header title. If TITLE is not present, then a default title "Related Action History" is shown.
  2. If ITEM_TYPE is present and ITEM_KEY is not, For Example: {TITLE}[ITEM_TYPE]PROCESS_NAME:ACTIVITY_LABEL_NAME , the Related Action History is populated from parent item type of the current item.
  3. If both ITEM_TYPE and ITEM_KEY is present, For Example: {TITLE}[ITEM_TYPE:ITEM_KEY]PROCESS_NAME:ACTIVITY_LABEL_NAME , the Related Action History is populated from that specific instance activity.

Figure 2 - Depicts Related Action History feature

Tuesday Nov 13, 2012

Using GMail's SMTP and IMAP servers in Notification Mailer


GMail offers free, reliable, popular SMTP and IMAP services, because of which many people are interested to use it. GMail can be used when there are no in-house SMTP/IMAP servers for testing or debugging purposes. This blog explains how to install GMail SSL certificate in Concurrent Tier, testing the connection using a standalone program, running Mailer diagnostics and configuring GMail IMAP and SMTP servers for Workflow Notification Mailer Inbound and Outbound connections.

GMail servers configuration

SMTP server

Host Name
SSL Port  465
TLS/SSL required  Yes
User Name  Your full email address (including or
Password  Your gmail password

 IMAP server

 Host Name
 SSL Port
TLS/SSL Required
 User Name
 Your full email address (including or
 Password Your gmail password

GMail SSL Certificate Installation

The following is the procedure to install the GMail SSL certificate

  • Copy the below GMail SSL certificate in to a file eg: gmail.cer


  • Install the SSL certificate into the default JRE location or any other location using below command
  • Installing into a dfeault JRE location in EBS instance
        # keytool -import -trustcacerts -keystore $AF_JRE_TOP/lib/security/cacerts  -storepass changeit -alias gmail-lnx_chainnedcert -file gmail.cer
  • Install into a custom location

        # keytool -import -trustcacerts -keystore <customLocation>  -storepass changeit -alias gmail-lnx_chainnedcert -file gmail.cer
       <customLocation> -- directory in instance where the certificate need to be installed

  • After running the above command you can see the following response

        Trust this certificate? [no]:  yes
        Certificate was added to keystore

Running Mailer Command Line Diagnostics

  • Run Mailer command line diagnostics from conccurrent tier where Mailer is running, to check the IMAP connection using the below command

$AFJVAPRG -classpath $AF_CLASSPATH -Dprotocol=imap -Ddbcfile=$FND_SECURE/$TWO_TASK.dbc -Dport=993 -Dssl=Y -Dtruststore=$AF_JRE_TOP/lib/security/cacerts -Daccount=<gmail username> -Dpassword=<password> -Dconnect_timeout=120 -Ddebug=Y -Dlogfile=GmailImapTest.log -DdebugMailSession=Y

  • Run Mailer command line diagnostics from concurrent tier where Mailer is running, to check the SMTP connection using the below command 

 $AFJVAPRG -classpath $AF_CLASSPATH -Dprotocol=smtp -Ddbcfile=$FND_SECURE/$TWO_TASK.dbc -Dport=465 -Dssl=Y -Dtruststore=$AF_JRE_TOP/lib/security/cacerts -Daccount=<gmail username> -Dpassword=<password> -Dconnect_timeout=120 -Ddebug=Y -Dlogfile=GmailSmtpTest.log -DdebugMailSession=Y

Standalone program to verify the IMAP connection

Run the below standalone program from the concurrent tier node where Mailer is running to verify the connection with GMail IMAP server. It connects to the GMail IMAP server with the given GMail user name and password and lists all the folders that exist in that account. If the GMail IMAP server is not working for the  Mailer check whether the PROCESSED and DISCARD folders exist for the GMail account, if not create manually by logging into GMail account.

Sample program to test GMail IMAP connection

 The standalone program can be run as below

 $java GmailIMAPTest GMailUsername GMailUserPassword           

Standalone program to verify the SMTP connection

Run the below standalone program from the concurrent tier node where Mailer is running to verify the connection with GMail SMTP server. It connects to the GMail SMTP server by authenticating with the given user name and password  and sends a test email message to the give recipient user email address.

Sample program to test GMail SMTP connection

The standalone program can be run as below

 $java GmailSMTPTest GMailUsername GMailPassword recipientEmailAddress   


  • As is an external domain, the Mailer concurrent tier should allow the connection with GMail server
  • Please keep in mind when using it for corporate facilities, that the e-mail data would be stored outside the corporate network

Thursday Aug 30, 2012

Implementing a post-notification function to perform custom validation


Oracle Workflow Notification System can be extended to perform extra validation or processing via PLSQL procedures when the notification is being responded to. These PLSQL procedures are called post-notification functions since they are executed after a notification action such as Approve, Reject, Reassign or Request Information is performed. The standard signature for the post-notification function is

    procedure <procedure_name> (itemtype  in varchar2,
                                itemkey   in varchar2,
                                actid     in varchar2,
                                funcmode  in varchar2,
                                resultout in out nocopy varchar2);


The post-notification function provides the parameter 'funcmode' which will have the following values:

  • 'RESPOND', 'VALIDATE, and 'RUN' for a notification is responded to (Approve, Reject, etc)
  • 'FORWARD' for a notification being forwarded to another user
  • 'TRANSFER' for a notification being transferred to another user
  • 'QUESTION' for a request of more information from one user to another
  • 'QUESTION' for a response to a request of more information
  • 'TIMEOUT' for a timed-out notification
  • 'CANCEL' when the notification is being re-executed in a loop.

Context Variables

Oracle Workflow provides different context information that corresponds to the current notification being acted upon to the post-notification function.

WF_ENGINE.context_nid - The notification ID 

WF_ENGINE.context_new_role - The new role to which the action on the notification is directed

WF_ENGINE.context_user_comment - Comments appended to the notification 

 WF_ENGINE.context_user - The user who is responsible for taking the action that updated the notification's state

WF_ENGINE.context_recipient_role - The role currently designated as the recipient of the notification. This value may be the same as the value of WF_ENGINE.context_user variable, or it may be a group role of which the context user is a member.

WF_ENGINE.context_original_recipient - The role that has ownership of and responsibility for the notification. This value may differ from the value of the WF_ENGINE.context_recipient_role variable if the notification has previously been reassigned. 


Let us assume there is an EBS transaction that can only be approved by a certain people thus any attempt to transfer or delegate such notification should be allowed only to users SPIERSON or CBAKER. The way to implement this functionality would be as follows:

  • Edit the corresponding workflow definition in Workflow Builder and open the notification.
  • In the Function Name enter the name of the procedure where the custom code is handled, for instance, TEST_PACKAGE.Post_Notification
  • In PLSQL create the corresponding package TEST_PACKAGE with a procedure named Post_Notification, as follows:

    procedure Post_Notification (itemtype  in varchar2,
                                 itemkey   in varchar2,
                                 actid     in varchar2,
                                 funcmode  in varchar2,
                                 resultout in out nocopy varchar2) is
      l_count number;
      if funcmode in ('TRANSFER','FORWARD') then
        select count(1) into l_count
        from WF_ROLES
        where WF_ENGINE.context_new_role in ('SPIERSON','CBAKER');
              --and/or any other conditions
        if l_count<1 then
          WF_CORE.TOKEN('ROLE', WF_ENGINE.context_new_role);
        end if;
      end if;
    end Post_Notification;
  • Launch the workflow process with the changed notification and attempt to reassign or transfer it. When trying to reassign the notification to user CBROWN the screen would like like below:

Notification transfer error

Check the Workflow API Reference Guide, section Post-Notification Functions, to see all the standard, seeded WF_ENGINE variables available for extending notifications processing. 

Tuesday Jun 19, 2012

E-Business Suite Proactive Support - Workflow Analyzer


The Workflow Analyzer is a standalone, easy to run tool created to read, validate and troubleshoot Workflow components configuration as well as runtime. It identifies areas where potential problems may arise and based on set of best practices suggests the Workflow System Administrator what to do when such potential problems are found. This tool represents a proactive way to verify Workflow configuration and runtime data to prevent issues ahead of time before they may become of more considerable impact on a production environment.


Since it is standalone there are no pre-requisites and runs on Oracle E-Business applications from 11.5.10 onwards. It is installed in the back-end server and can be run directly from SQL*Plus.

The output of this tool is written in a HTML file friendly formatted containing the following on both workflow Components configuration and Workflow Runtime data:
  • Workflow-related database initialization parameters
  • Relevant Oracle E-Business profile option values
  • Workflow-owned concurrent programs schedule and Workflow components status
  • Workflow notification mailer configuration and throughput via related queues and table
  • Workflow-relevant recommended and critical one-off patches as well as current code level
  • Workflow database footprint by reading Workflow run-time tables to identify aged processes not being purged. It also checks for large open and closed processes or unhealthy looping conditions in a workflow process, among other checks.

See a sample of Workflow Analyzer's output here

Besides performing the validations listed above, the Workflow Analyzer provides clarification on the issues it finds and refers the reader to specific Oracle MOS documents to address the findings or explains the condition for the reader to take proper action.

How to get it?

The Workflow Analyzer can be obtained from Oracle MOS Workflow Analyzer script for E-Business Suite Workflow Monitoring and Maintenance (Doc ID 1369938.1) and the supplemental note How to run EBS Workflow Analyzer Tool as a Concurrent Request (Doc ID 1425053.1) explains how to register and run this tool as a concurrent program. This way the report from the Workflow Analyzer can be submitted from the Application and its output can be seen from the application as well.

Tuesday May 29, 2012

Asynchronous Business Event Subscriptions - Troubleshooting Tips


This blog is intended as an example to help trace an asynchronous business event through it's execution within the Workflow Business Event System. This blog should also help clarify the myth among Oracle Workflow developers and administrators that all business events can be traced through Business Event System AQs.

As a reader of this blog post, it is expected that you understand following steps already.

  • Create a business event using Workflow Administrator Web Applications responsibility
  • Create subscriptions to business events
    • Synchronous subscriptions with phase <= 99
    • Asynchronous subscriptions with phase >100
    • Understand "On Error" subscription attributes such as "Stop and Rollback" and "Skip to Next"

It is strongly recommended that all business events and/or groups that has at least one LOCAL or EXTERNAL subscription should also have one ERROR subscription that launches following seeded error workflow process.

  • Workflow Type - WFERROR
  • Workflow Process - DEFAULT_EVENT_ERROR

If an error subscription is not created event subscription failures may go unnoticed. Create the error subscription as follows.



Sample Local Subscription

For testing purposes, let us assume following PLSQL rule function (in package XXX_PACKAGE) used in a LOCAL event subscription with phase > 99. This will cause the event to be enqueued to WF_DEFERRED queue and Workflow Agent Listener process to execute it in the background. This function inserts records into a temporary table.

    create table temp_table (key_value varchar2(50), result varchar2(20));
    create or replace package xxx_package is
      function subscription1 (p_subscription_guid in raw,
                              p_event in out nocopy wf_event_t) return varchar2;
    end xxx_package;
    create or replace package body xxx_package is
      function subscription1(p_subscription_guid in raw,
                           p_event in out nocopy wf_event_t) return varchar2 is
        l_result varchar2(20);   
        l_result := p_event.GetValueForParameter('OUTCOME');
        if l_result='GOOD' then
          insert into temp_table values (p_event.getEventKey(), l_result);
          return 'SUCCESS';
          insert into temp_table values (p_event.getEventKey(), l_result);
          wf_core.context('xxx_package','function subscription1', p_event.getEventName(), p_event.getEventKey());
          wf_event.setErrorInfo(p_event, 'ERROR');
          return 'ERROR';
        end if;
        when others then
          wf_core.context('xxx_package','function subscription1', p_event.getEventName(), p_event.getEventKey());
          wf_event.setErrorInfo(p_event, 'ERROR');
          return 'ERROR';
      end subscription1;
    end xxx_package;
IMPORTANT NOTE: Return value should be in UPPERCASE, otherwise the Business Event System will not recognize the result.

Test the business event

Write a PLSQL procedure to create and set the event parameters and then raise it. 

      l_event_name varchar2(50) := 'oracle.apps.fnd.wfds.user.userUpdated';
      l_event_key varchar2(50) := to_char(sysdate, 'DD-MM-RRRR HH:MI:SS');
      l_attributes wf_parameter_list_t;
      --Add the logic to be executed when the event occurs. In this case the
      -- creation of a user was signaled.
      -- ...
      --Add all the parameters to the list:
      --WF_EVENT.AddParameterToList('OUTCOME', 'WRONG', l_attributes);
      WF_EVENT.AddParameterToList('OUTCOME', 'GOOD', l_attributes);
      -- Raise the event
      WF_EVENT.Raise(p_event_name => l_event_name,
                     p_event_key => l_event_key,
                     p_parameters => l_attributes);

When this block runs with parameter OUTCOME set to 'GOOD', a record is inserted into TEMP_TABLE by the LOCAL subscription's rule function. When a different value is used the function returns ERROR and a record is insert into the temporary table. But since the result is ERROR, the transaction is rolled back and error subscription is executed. The Business Event System uses the error subscription to launch WFERROR:DEFAULT_EVENT_ERROR process to send error notification to SYSADMIN with the details of the exception. These error details shown on the notification are as a result of the calls to WF_EVENT.SetErrorInfo and WF_CORE.Context in the subscription rule function.


Troubleshooting Tips

  • Only Busienss Events with asynchronous subscriptions are enqueued to WF_DEFERRED or WF_JAVA_DeFERRED queues based on whether the subscription is PLSQL based or Java based. All events with synchronous subscriptions are executed in the same thread they are raised in and not enqueued to any AQs.
    NOTE: The event's synchronous subscriptions themselves may enqueue the events to some Out Agents such as WF_JMS_OUT or WF_WS_JMS_OUT and so on which is purely specific to subscription's implementation and not related to core Business Event processing.
  • From Workflow Manager, ensure the Workflow Deferred Agent Listener and the Workflow Java Deferred Agent Listener components are running
  • Ensure an ERROR subscription is created for the business event
  • To trace a business event with Asynchronous Subscription from Raise to Dispatch to Error
    • Ensure an error subscription was created as in the sample above
    • Stop Workflow Deferred Agent Listener and Workflow Error Agent Listener
    • Raise the event
    • Verify the event is enqueued to WF_DEFERRED using below SQL. Assuming the event key is unique across all occurences, it should return 1
      select count(1) from$wf_deferred a where a.user_data.event_name = '&eventName' and a.user_data.event_key = '&eventKey' and a.msg_state = 'READY';
    • Start Workflow Deferred Agent Listener and after few minutes verify the event is processed successfully using above SQL. The count should be 0
    • If the event was not dispatched successfully, check if the event is enqueued to WF_ERROR queue using SQL. If the event errored, it should be in error queue. If this SQL returns 0, the subscription was executed successfully. select count(1) from$wf_error a where a.user_data.event_name = '&eventName'and a.user_data.event_key = '&eventkey'and a.msg_state = 'READY'
    • Start Workflow Error Agent Listener. If there was a record in WF_ERROR queue, after few minutes verify the event is processed successfully using above SQL
    • Now check SYSADMIN's worklist for error notification with details of the error.
  • To obtain E-Business Debug Log messages for business event processing
    • Enable Log profile options for the E-Business Suite user whose session triggers the business event.
      FND: Debug Log Enabled=YES
      FND: Debug Log Level=STATEMENT
      FND: Debug Log Module=wf.plsql%
    • In the case where the event is raised from a PLSQL block you can add the following at begining of the procedure to identify the session and to activate the debug profile options.



        fnd_global.apps_initialize(user_id=>0, resp_id=>24240, resp_appl_id=>1);



      fnd_global.apps_initialize will enable the profile options for this PLSQL block for user SYSADMIN, application 'System Administration' and responsibility 'System Administrator'
    • Then query table APPLSYS.FND_LOG_MESSAGES where column MODULE like 'wf.plsql%' to see the debug messages
      sqlplus apps/***** @$FND_TOP/patch/115/sql/wfdbgprnt wf.plsql%


Oracle Workflow API Reference, section 'Event Subscription Rule Function APIs'

Oracle Workflow Developer's Guide, section 'Error Handling for Event Subscription Processing'

Wednesday May 09, 2012

Oracle E-Busienss Suite RCD - Applications Technology Releases 12.1 and 12.2

Oracle E-Business Suite Release Content Documents for Releases 12.1 and 12.2 are available on MOS. The Release Content Documents (RCDs) communicate information about new or changed functionality introduced in Oracle E-Business Suite Release 12.1 and in subsequent Release Update Packs (RUPs) and off-cycle patches, as well as planned enhancements for the upcoming Release 12.2. For your convenience, they also include new or changed functionality introduced in the RUPs for Release 12, including 12.0.2 through 12.0.7.

Release Content Document - Applications Technology Releases 12.1 and 12.2

Oracle Workflow introduces following new features in Releases 12.1 and 12.2

Release 12.1.1

  • Worklist - Bulk Notification Response and Bulk Notification Close
  • Hijrah/Thai Calendar Support

Release 12.1.3

  • Notification Mailer - SMTP Authentication

Release 12.2

  • E-mail Character Encoding Configuration 
  • Deferring Worklist Response Processing
  • Oracle RAC Affinity for Workflows
  • Worklist Usability Enhancements 

Tuesday Apr 17, 2012

SMTP Authentication Feature in R12.1.3


Oracle E-Business Suite Workflow Notification Mailer leverages the functionality of SMTP and IMAP services to send and receive notification and alert emails respectively. Until E-Business Suite Release 12.1.3, Workflow Notification Mailer supports authentication for only IMAP server connections. Starting Release 12.1.3, Workflow Notification Mailer supports authentication for SMTP servers.

Main reasons to support authentication for SMTP servers are,

  1. An attacker could hijack the SMTP connection either pretending the server does not support the Authentication extension or causing all AUTH commands to fail.
  2. A SMTP server accessible over public domain could be misused by spammers to hide their identify and send spam e-mails.

How to configure

  • Go to Workflow Manager Screen and navigate to Workflow Notification Mailer page.
  • Edit the Workflow Mailer configuration, update "SMTP user" and "SMTP Password" parameters, SAVE and bounce the Workflow Service Container.

Authentication Mechanisms

    Workflow Mailer supports PLAIN, LOGIN and CRAM-MD5 mechanisms with JavaMail version 1.4.

How to check

On a non-SSL enabled SMTP server, it can be checked easily: 

$ - telnet 25
Connected to (
Escape character is '^]'.
220 ESMTP Sendmail 8.13.8/8.13.8; Tue, 17 Apr 2012 10:11:36 -0400
EHLO Hello [], pleased to meet you
250 HELP

Wednesday Aug 04, 2010

Configurable User LOV in Worklist UI

User LOV is a UI component that exposes Workflow Directory Services to end-users in Worklfow pages to select a user or a role while performing actions on a notification such as Reassign, Request Information or setting up rules such as Vacation Rules or Worklist Access. By default the User LOV has always provided complete access to all the users and roles in the Directory Services to the end-users regardless of where they belong.


Oracle Workflow has now released a new feature that uses AOL's Data Security features to provide an option for Customers to configure the User LOV to stripe the data as per current user context. This allows certain users to see only certain group of users in the User LOV while accessing workflow notification pages. More information about how to use this feature is available in below My Oracle Support document.

Configuring the Oracle Workflow User List of Values, Release 12.0.6 and Release 12.1.1

Tuesday Aug 03, 2010

Oracle Business Event and Subsciptions Execution Flow

This blog post contributed by Shivdas Tomar.

Please read earlier post about Workflow Business Event System.

We will see the exact execution flow when an event is raised using a PLSQL API and a Java API.

Event raised using PLSQL API

As soon as event is deferred to WF_DEFERRED or WF_JAVA_DEFERRED, control is returned back to calling program. Workflow Deferred Agent Listener and Workflow Java Deferred Agent Listener continues execution of the subscriptions respectively from these queues. If there is any error during subscription or generate function execution, event will be enqueued to WF_ERROR or WF_JAVA_ERROR queue respectively. The Error Agent Listeners then execute error subscriptions associated to the event.


Event raised using Java API

Once event enqueued to WF_JAVA_DEFERRED queue, further execution will be resumed from the deferred subscription, by Workflow Deferred Java Agent Listener. If any error occurs during processing of a subscription by the Deferred Java Agent Listener, event is enqueued to WF_JAVA_ERROR queue.



Understanding AQs in Workflow

This blog post contributed by Shivdas Tomar.

In Oracle Workflow, Advanced Queues are used for inter-process communication, background processing, sending messages to external agents and so on. Many times the messages may not be dequeued by the consumers such as Workflow Agent Listeners or Workflow Background Engines.


  • Workflow Agent Listeners or Background engines are not able to dequeue messages in READY state.
  • Messages continue to be in WAIT state even after passing the "delay" interval
  • Processed messages are not purged after passing the "retention" interval
  • Queue propagation is not happening


Always check AQ view (AQ$<Queue_Table_Name> for message state and not the under lying table directly.

  • If messages are in READY state but consumers such as Workflow Agent Listeners and Workflow Background Engines are not able to dequeue, then there might be issues with message recipients or AQ subscribers. Check the CONSUMER_NAME and ADDRESS columns value in that AQ and then the subscriber rule sets.
  • If event messages are not moving from one state to another, check AQ_TM_PROCESSES parameter's value to be greater than 0.
Note: In 10gR1 or later database releases, the AQ time management and many other background processes are automatically controlled by a coordinator-slave architecture called Queue Monitor Coordinator (QMNC). QMNC dynamically spawns slaves named qXXX depending on the system load.
If you want to disable the Queue Monitor Coordinator, then you must set AQ_TM_PROCESSES = 0 in your pfile or spfile. Oracle strongly recommends that you DO NOT set AQ_TM_PROCESSES = 0. If you are using Oracle Streams, setting this parameter to zero (which Oracle Database respects no matter what) can cause serious problems. So either remove AQ_TM_PROCESSES parameter or do not set its value as zero.
  • Check if processes, named like 'qmnc' or 'ora_qxxx' are running at the OS level. If there are no such process(es) running then bounce the Oracle Database after removing AQ_TM_PROCESSES or changing its value to a non-zero value as recommended in Oracle Applications setup documentation.

  • If Queue propagation is not happening, job_queue_processes parameter's value should be checked.
Note: In 11gR1 or later database releases, the init.ora parameter JOB_QUEUE_PROCESSES does not need to be set for AQ propagations. AQ propagation is now handled by DBMS_SCHEDULER jobs rather than DBMS_JOBS.
Propagation takes advantage of the event based scheduling features of DBMS_SCHEDULER for better scalability. If the value of the JOB_QUEUE_PROCESSES database initialization parameter is zero, then that parameter does not influence the number of Oracle Scheduler jobs that can run concurrently. However, if the value is non-zero, it effectively becomes the maximum number of scheduler jobs and job queue jobs that can run concurrently. If a non-zero value is set, it should be large enough to accommodate a scheduler job for each Messaging Gateway agent to be started.

This blog is dedicated to bring latest information on Oracle Workflow new features, best practices, troubleshooting techniques and important fixes directly from it's Development Team.


« November 2015