Saturday, December 21, 2024

Workflow debugging scripts wfstat.sql

 Understanding the Workflow debugging scripts wfstat.sql


The wfstat.sql script is a valuable tool used in Oracle E-Business Suite (EBS) for debugging and understanding the status and flow of workflows. It helps track, analyze, and debug workflow-related issues by providing detailed insights into the workflow statuses, activities, notifications, and related details.

Here’s how to understand and use the wfstat.sql script for debugging workflows:


Purpose of wfstat.sql

  • To fetch the status of a specific workflow instance.
  • To provide detailed information on the workflow's current state, activities, notifications, and their statuses.
  • To debug issues in workflow execution, such as stuck or errored activities.

Key Parameters of wfstat.sql

  1. ITEM_TYPE: The type of workflow item (e.g., REQAPPR for requisition approval, POAPPRV for purchase order approval).
  2. ITEM_KEY: The unique identifier for a specific workflow instance.
  3. USER_ID (optional): Used to filter workflow details specific to a user.
  4. ACTIVITY_STATUS: Filters activities based on their status (e.g., OPEN, COMPLETED, ERROR).

Steps to Use wfstat.sql

  1. Locate the script: The wfstat.sql script is typically located in $FND_TOP/sql/ or your database administrator may provide access to the script.
  2. Run the script: Execute the script using SQL*Plus or a similar SQL client.
    SQL> @wfstat.sql
  3. Provide Input: Enter the required parameters such as ITEM_TYPE and ITEM_KEY when prompted.
  4. Analyze the Output:
    • Workflow Instance Information: Details about the workflow, including creation date, status, and current owner.
    • Activity Statuses: Shows activities in the workflow, their status (OPEN, COMPLETED, ERROR), and timestamps.
    • Notifications: Information on notifications sent as part of the workflow, including status (SENT, CANCELED, ERROR).
    • Error Details: If an activity is in error, the output will indicate the error message or stack trace.

Debugging Common Issues

  1. Stuck Activities:
    • Check for OPEN activities that have not progressed.
    • Identify the ACTIVITY_NAME and trace the issue in the corresponding PL/SQL procedure or function.
  2. Errored Activities:
    • Look for activities with the status ERROR.
    • Review the error messages or stack trace in the output.
  3. Notification Issues:
    • Check the notification statuses (SENT, CANCELED, ERROR).
    • If notifications are not being sent, verify the workflow mailer service and notification preferences.
  4. Workflow Ownership:
    • Ensure that the workflow item has the correct owner (RUNNING or DEFERRED).
    • Reassign ownership if necessary using administrative workflow tools.

Proactive Measures

  • Schedule regular audits of critical workflows using scripts like wfstat.sql.
  • Monitor notifications and activity logs for potential issues.
  • Automate repetitive tasks in workflow monitoring using shell scripts or custom reports.

By using the wfstat.sql script effectively, you can identify, troubleshoot, and resolve workflow-related issues, ensuring seamless operation of Oracle E-Business Suite workflows.


While logging a bug in Workflow area, it is always advisable to provide output of some of the diagnostic scripts such as wfstat.sql. This blog provides a detailed description about the usage of and the information this script provide. Output of wfstat.sql script provides workflow activity details for a given workflow process. Output of wfmlrdbg.sql provides details about a particular notification that are used to debug any issues with a Workflow Notification. wfbesdbg.sql is used to debug the event and subscription related issues in Business Event System.

wfstat.sql

This script can be used to debug the workflow activity issues for a given workflow. It can be run using the below command. Use spool command to generate the output of this into a text file.


SQL>spool wfstat.txt
SQL>sqlplus apps/apps @$FND_TOP/sql/wfstat.sql <item type> <item key>
SQL>spool off;


It generates a text file called wfstat.txt that contains output of this script. You can get the following information from this:

  1. Workflow item type and itemkey
  2. Workflow activities' start time and end time
  3. Parent process and child process information
  4. Status and result of each activity
  5. Start date and End date of each activity
  6. Errored Activities and Error Process Activity Statuses
  7. Notification details with notification id and notification recipient
  8. Performer of each activity.

The following section explains each item from the output file:

WorkFlow Item

It provides item type, item key, start date and end date for the workflow item. It also provides the root activity details for the same.

Activity Statuses

It provides start date, end date, status, result for each of the activities. In addition to that it provides the performer user and notification ID for Notification activities. It also provides the sequence of execution of the activities.

Activity Statuses History

It provides status history of the all the actions performed on the different activities

Notifications

It provides information about a notification such as Notification ID, status, message name, begin date, end date, from-user, to-user, subject.

Errored Activities

It provides all the activities information that are resulted into ERROR status.

No comments: