oracle workflow - by dinesh kumar s

85
Oracle Workflow Builder – by Dinesh Kumar S

Upload: dineshcse86gmailcom

Post on 08-Sep-2015

63 views

Category:

Documents


15 download

DESCRIPTION

Oracle Workflow - by Dinesh Kumar S In this guide i have explained various features of Oracle WF and its development with Screenshots. Important concepts is been covered which will be helpful in learning the Workflow Quickly and easily.

TRANSCRIPT

  • Oracle Workflow Builder by Dinesh Kumar S

  • Oracle Workflow Builder by Dinesh Kumar S

    About Oracle Workflow: Why Workflow? It automates & streamlines business process. What Workflow does? It routs information to Roles (User/Group of Users) based on rules.

    Key: Rules Procedures. Process Routes. Activity Actions Performed.

    Rule 1

    Rule 2

    Rule 3

    Rule 4

    Routing

    Information

  • Oracle Workflow Builder by Dinesh Kumar S

    Workflow Major Components

    WF Builder WF Engine WF Definition Loader Notification Systems WF Monitor

    WF Builder:

    - Graphical Interface. - Used to Modify & create business process. - 2 Windows available [navigator, process Diagram].

    WF Engine:

    - It is embedded in oracle DB. - Monitors the WF status and co-ordinates the routing of activities.

    WF Definition Loader:

    - The utility program that moves WF definitions b/w DB and corresponding flat file representation. - Its a standalone server program. - Integrated into WF builder.

  • Oracle Workflow Builder by Dinesh Kumar S

    WF Notification System:

    - Automatically Notify users. - Send Notification to individuals or roles. - Automatic Notification forwarding.

  • Oracle Workflow Builder by Dinesh Kumar S 1 - Notification Activity encounters. 2 - When WF encounters notification activity, it calls notification system API to send a notification. 3 - Notification system communicates with directory services to get roles and user information to

    whom the Notification to be sent.

    4 - Notification system communicates with mailer and web agent to get the following data. Messages & message Attributes. Notification preference for the role.

    5 - Notification system communicates with Notification viewer to display messages through web

    Browser.

    WF Monitor:

    - Graphically monitors & administrate workflow transactions. - It supports the below features.

    Java Applet: To view WF Activity diagrammatically. View Transaction action history. Retry / Skip Activity. Resend & rerun any process.

    - Action Summary of Key Activities.

  • Oracle Workflow Builder by Dinesh Kumar S

    Workflow Data Model: Objects Description Item Type Classification of components that makes Workflow process. Attribute An item type attribute is a property associated with a given item

    type. A Global variable that can be used across by any activity inside WF.

    Process Manages Business Process according to the business process rules defined. It derives relationship b/w the activities.

    Function An automated unit of work usually defined as a PLSQL stored procedures & functions.

    Event An event activity represents a business event from the Business Event System within a workflow process.

    Notification When the workflow engine reaches a notification activity, it issues a Send ( ) API call to the Notification System to send the message to an assigned performer.

    Message A message is what a notification activity sends to a role in a workflow process.

    Lookup Types A lookup type is a static list of values. These lists can be referenced by activities and by item type, message or activity attributes.

    Transactions The relationship b/w two activities represented by an arrow [transition].

  • Oracle Workflow Builder by Dinesh Kumar S

    Master Table Details:

    Workflow Master Tables Table Name Description WF_ITEM_TYPES The details of internal names of item types will be stored.

    WF_ITEM_TYPES_TL Translation table for WF_ITEM_TYPES

    WF_ITEM_ATTRIBUTES The details of Item attribute.

    WF_ACTIVITIES The details of activities involved in business process.

    WF_ACTIVITY_ATTRIBUTES The details of attributes associated with activities.

    WF_ACTIVITY_TRANSITIONS The transition details b/w the activities of the process

    WF_PROCESS_ACTIVITIES All details of process includes Activity, sub-processes etc.

    WF_MESSAGES The message definition details.

    WF_MESSAGE_ATTRIBUTES The details about Attributes associated with Messages. WF_LOOKUP_TYPES The details of Lookup Type definitions. WF_LOOKUPS Details of lookup Codes created for lookup types. WF_NOTIFICATIONS Notification details defined inside item type. WF_NOTIFICATION_ATTRIBUTES Details of attributes associated with notification. WF_ITEMS Information of all the workflow process & its history. WF_ITEM_ACTIVITY_STATUSES Activity status of all activity for different item type instance. WF_ITEM_ATTRIBUTE_VALUES The values of all the attributes associated with the item type at

    the particular instance. WF_ACTIVITY_ATTR_VALUES The values of activity attributes for all the activities for different

    instances of the workflow items. WF_ROUTING_RULES The routing rules defined by user like forward, re-assign, reject

    etc.

  • Oracle Workflow Builder by Dinesh Kumar S Types of Workflow Process: Synchronous 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.

    Asynchronous 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 de-queued 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.

    Activity Cost:

    Each function activity and event activity has a cost associated with it. The cost is a value representing the number of seconds it takes for the Workflow Engine to execute the activity.

    If you do not know how long it takes for the Workflow Engine to perform the activity, you can enter an estimated cost and update it later as you accumulate more information about its performance. Generally, you should assign complex, long running activities a high cost.

    The valid range for cost is 0 to 1,000,000. Note** although the cost is entered and displayed in seconds in Oracle Workflow Builder, it is actually converted and stored in the database as hundredths of a second.

    In normal processing, the Workflow Engine completes the execution of a single activity before continuing to a subsequent activity.

    In some cases, an activity might take so long to process that background processing would be more appropriate. The default threshold for the Workflow Engine is 50 hundredths of a second. Activities with a cost higher than this are deferred to background engines.

  • Oracle Workflow Builder by Dinesh Kumar S 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 en-queues 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 en-queue time.

    Deferred Activity: When an activity is deferred, the main Workflow Engine can then continue to the next available activity, which may occur on some other parallel branch of the process. If no other activity is available to be executed, the Workflow Engine returns control immediately to the calling application. The user remains unaware that processing is still taking place, rendering a faster execution time. To defer an activity,

    Activity Cost > Threshold Cost The threshold cost is a PL/SQL package variable with a default value of 50 hundredths of a second. Set a cost above this threshold for all activities that you don't want the user to wait for. At runtime, the Workflow Engine defers any thread to the background as soon as it encounters an activity with a cost higher than the threshold. Then the background engine later identifies the process as deferred and continues its execution.

  • Oracle Workflow Builder by Dinesh Kumar S Workflow Access Protection:

    Access protection is a feature that prevents workflow seed data created by a 'seed data provider' from being modified by a 'seed data consumer'.

    'seed data provider' --> any organization that creates 'seed data' for other organizations ('seed data consumers') to use in defining and customizing a workflow process.

    Workflow objects definitions that can be customized. Workflow object definitions protected against customization.

    Scenario: There are 2 teams in my organization Global Team & Regional Team. Global Team does development across all regions where as regional team does development within their own region and not shared by other. Consider my organization Global team using oracle std. item type in my workflow in a custom workflow process. Now my organization wants to enable below protections, Identify certain workflow objects in its custom workflow definition as corporate standards that the regional teams should adhere to and not modify. Designate certain objects in its deployed process as customizable for the regional offices to alter to their offices' needs.

  • Oracle Workflow Builder by Dinesh Kumar S How this can be achieved? By using Access Protection Feature in Oracle Workflow. Access Protection Features:

    1. Access Level 2. Customization Level 3. Protection Level

    The combination of protection, customization, and access levels make up the access protection feature and

    determines whether a user can modify a given workflow object. The level, in all three cases, is a numeric value ranging from 0 to 1000 that indicates the relationship between

    different organizations as providers and consumers of seed data. The following ranges of levels are presumed by Oracle Workflow: 0-9 Oracle Workflow 10-19 Oracle Application Object Library 20-99 Oracle Applications development 100-999 Customer organization. You can determine how you want this range to be interpreted. For example, 100 can

    represent headquarters, while 101 can represent a regional office, and so on. 1000 Public Access Level:

    A "user of Oracle Workflow" in this case, represents someone who is operating Oracle Workflow Builder, or the Workflow Definitions Loader program, which loads workflow process definitions from a file into a database. As a seed data provider, you should always operate Oracle Workflow Builder at the same consistent access level because the level you work at affects the protection level of the seed data you create.

    You can view your access level as follows:

    In Oracle Workflow Builder, select About Workflow from the Help menu.

    If you are going to run the Workflow Definitions Loader program to download workflow process definitions from the database to a file, check the value for the environment variable WF_ACCESS_LEVEL on your workflow server.

  • Oracle Workflow Builder by Dinesh Kumar S Protection Level: Whenever you create a workflow object in Oracle Workflow Builder, you have the option of protecting the object at a certain level. An object's protection level helps control whether other users can modify the object based on their access levels, by allowing only users with an access level equal to or lower than the object's protection level to modify the object. The protection level that you set for an object is dependent on the setting of the Lock at this Access Level check box and on your current access level.

    If you check the Lock at this Access Level check box, the protection level for the object is set to your current access level. Users with an access level higher than your current access level will not be able to modify the object. These users will see a small lock on the workflow object's icon, indicating that the object can be used but not modified. For users with an access level equal to or lower than your current access level, the customization level for the object will determine whether they can modify the object.

    If you do not check the Lock at this Access Level check box, the protection level for the object is set to 1000. In this case all users who are not restricted by the customization level can modify the object.

    Customization Level:

    Every workflow object, in addition to having a protection level, also records a customization level when you modify the object and save it to a database or file. An object's customization level helps control whether other users can modify the object based on their access levels, by allowing only users with an access level equal to or higher than the object's customization level to modify the object.

    Setting the customization level ensures that a customizable object that has been customized never gets overwritten

    during a seed data upgrade, because the upgrade always occurs with the Workflow Definitions Loader operating at an access level below the customized object's customization level.

  • Oracle Workflow Builder by Dinesh Kumar S Workflow Definition Loader (WFLOAD): We use the Workflow Definitions Loader to save or load process definitions from a database or flat file. We can also define as it is a utility that moves workflow data between a file and a database and it is also used to upgrade, upload and download the workflow data. Usage:

    Normally when we upgrade our database, we use the Workflow Definitions Loader to preserve and back up our process definitions to a flat file. When the database upgrade is completed, we use the Loader program again to upload the definitions back into your database.

    We can also use the Loader program to upgrade our database with a newer version of a process definition or to transfer process definitions to other databases.

    Modes: The Workflow Definitions Loader automatically validates the process definition to ensure that it conforms to specific process design rules. There are four modes available with WFLOAD.These are as follows:

    1) DOWNLOAD - Download the WF definitions into Flat file. 2) UPGRADE Honors both protection and customization levels of data 3) UPLOAD Honors only protection level of data [No respect of Customization Level] 4) FORCE Force upload regardless of protection or customization level

    WFLOAD Username/password Y .wft For Example, WFLOAD apps/apps 0 Y DOWNLOAD poxwfrqa.wft POAPWF

  • Oracle Workflow Builder by Dinesh Kumar S Workflow APIs: Below are some important APIs frequently used in workflow development / customizations. WF_ENGINE APIs

    WF_ENGINE. CreateProcess CreateProcess (itemtype in varchar2,itemkey in varchar2,process in varchar2 default ); Creates a new runtime process for an application item. For example, a Requisition item type may havea 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.

    WF_ENGINE. SetItemUserKey SetItemUserKey (itemtype in varchar2,itemkey in varchar2, userkey in varchar2); Lets you set a userfriendly 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 userfriendly identifier to locate items in the Workflow Monitor and other user interface components of Oracle Workflow.

    WF_ENGINE. GetItemUserKey GetItemUserKey (itemtype in varchar2,itemkey in varchar2) return varchar2; Returns the userfriendly key assigned to an item in a process, identified by an item type and item key. The user key is a userfriendly identifier to locate items in the Workflow Monitor and other user interface components of Oracle Workflow.

    WF_ENGINE. SetItemOwner SetItemOwner (itemtype in varchar2,itemkey in varchar2,owner in varchar2); 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.

    WF_ENGINE. StartProcess StartProcess (itemtype in varchar2,itemkey in varchar2); 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 itemtype and itemkey before calling StartProcess( ).

    WF_ENGINE. LaunchProcess LaunchProcess (itemtype in varchar2,itemkey in varchar2,process in varchar2 default'',userkey in varchar2 default '',owner in varchar2 default ''); Launches a specified process by creating the new runtime process and beginning its execution. This is a wrapper that combines CreateProcess and StartProcess.

    WF_ENGINE. SuspendProcess SuspendProcess (itemtype in varchar2,itemkey in varchar2,process in varchar2 default ''); 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( ). ResumeProcess(itemtype in varchar2,itemkey in varchar2,process in varchar2 default ''); Returns a suspended process to normal execution status. Any activities that were transitioned to while the process was suspended are now executed.

    WF_ENGINE. AbortProcess AbortProcess (itemtype in varchar2,itemkey in varchar2,process in varchar2 default '',result in varchar2 default eng_force); 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.

    WF_ENGINE. AddItemAttr AddItemAttr (itemtype in varchar2,itemkey in varchar2,aname in varchar2); Adds an empty item type attribute variable to the process. Although most item

  • Oracle Workflow Builder by Dinesh Kumar S type attributes are defined at design time, developers can create new attributes at runtime for a specific process.

    WF_ENGINE. SetItemAttrText SetItemAttrText(itemtype in varchar2,itemkey in varchar2,aname in varchar2,avalue in varchar2);

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

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

    WF_ENGINE. GetItemAttrText GetItemAttrText(itemtype in varchar2,itemkey in varchar2,aname in varchar2) return varchar2;

    WF_ENGINE. GetItemAttrNumber GetItemAttrNumber(itemtype in varchar2,itemkey in varchar2,aname in varchar2) return number;

    WF_ENGINE. GetItemAttrDate GetItemAttrDate(itemtype in varchar2,itemkey in varchar2,aname in varchar2) return date;

    WF_ENGINE. BeginActivity BeginActivity (itemtype in varchar2,itemkey in varchar2,activity in varchar2); 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.

    WF_ENGINE. CompleteActivity CompleteActivity(itemtype in varchar2,itemkey in varchar2,activity in varchar2,result_code in varchar2); Notifies the workflow engine that the specified activity has been completed for a particular item.

    WF_ENGINE. ItemStatus ItemStatus(itemtype in varchar2,itemkey in varchar2,status out varchar2,result out varchar2); 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.

    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. WF_CORE. CLEAR CLEAR Clears the error buffers. WF_CORE. GET_ERROR GET_ERROR(err_name out varchar2,err_message out varchar2 err_stack out

    varchar2); 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.

    WF_CORE. RAISE RAISE (name in varchar2); Raises an exception to the caller by supplying a correct error number and token substituted message for the name of the error message provided.

    Workflow Directory Service APIs: WF_DIRECTORY. GetRoleUsers GetRoleUsers(role in varchar2,users out UserTable);

    Returns a table of users for a given role. WF_DIRECTORY. GetUserRoles GetUserRoles(user in varchar2,roles out RoleTable);

    Returns a table of roles that a given user is assigned to. WF_DIRECTORY. GetRoleInfo GetRoleInfo(Role in varchar2,Display_Name out varchar2,Email_Address out

    varchar2,Notification_Preference out varchar2,Language out varchar2,Territory out varchar2); Returns the following information about a role:

  • Oracle Workflow Builder by Dinesh Kumar S Display name Email address Notification Preference ('QUERY', 'MAILTEXT', 'MAILHTML','MAILATTH',

    'SUMMARY') Language Territory

    WF_DIRECTORY. IsPerformer IsPerformer (user in varchar2,role in varchar2); Returns true or false to identify whether a user is a performer of a role.

    WF_DIRECTORY. GetRoleName GetRoleName (p_orig_system in varchar2,p_orig_system_id in varchar2,p_name out varchar2,p_display_name out varchar2); Returns a Workflow display name and role name for a role given the system information from the original user and roles repository.

    WF_DIRECTORY. SetAdHocUserStatus SetAdHocUserStatus (user_name in varchar2,status in varchar2 default 'ACTIVE'); Sets the status of an ad hoc user as 'ACTIVE' or 'INACTIVE'.

    WF_DIRECTORY. SetAdHocRoleStatus SetAdHocRoleStatus (role_name in varchar2,status in varchar2 default 'ACTIVE'); Sets the status of an ad hoc role as 'ACTIVE' or 'INACTIVE'.

    WF_DIRECTORY. CreateAdHocUser CreateAdHocUser (name in out varchar2,display_name in out varchar2, language in varchar2 default null, territory in varchar2 default null, description in varchar2 default null, notification_preference in varchar2 default 'MAILHTML', email_address in varchar2 default null, fax in varchar2 default null, status in varchar2 default 'ACTIVE', expiration_date in date default sysdate); Creates a user at runtime by creating a value in the WF_LOCAL_USERS table. This is referred to as an ad hoc user.

    WF_DIRECTORY. CreateAdHocRole CreateAdHocRole (role_name in out varchar2, role_display_name in out varchar2, language in varchar2 default null, territory in varchar2 default null, role_description in varchar2 default null, notification_preference in varchar2 default'MAILHTML', role_users in varchar2 default null, email_address in varchar2 default null, fax in varchar2 default null, status in varchar2 default 'ACTIVE',expiration_date in date default sysdate); Creates a role at runtime by creating a value in the WF_LOCAL_ROLES table. This is referred to as an ad hoc role.

    WF_DIRECTORY. AddUsersToAdHocRole

    AddUsersToAdHocRole (role_name in varchar2,role_users in varchar2); Adds users to a existing ad hoc role.

    WF_DIRECTORY. RemoveUsersFromAdHocRole

    RemoveUsersFromAdHocRole (role_name in varchar2,role_users in varchar2 default null); Removes users from an existing ad hoc role.

  • Oracle Workflow Builder by Dinesh Kumar S

    Sample Workflow 1

    Description: Send PO Details to user [Role].

  • Oracle Workflow Builder by Dinesh Kumar S Pre requisites: Import oracle standard file WFSTD.wft. It will be available in oracle database in the below path \oracle\ora92\wf\DATA\US Step 1: New Item Type Creation.

  • Oracle Workflow Builder by Dinesh Kumar S New Item_type created.

    Step 2: New Attributes Creation Right Click Attribute create new attribute.

  • Oracle Workflow Builder by Dinesh Kumar S PO_NUMS

    ORG_NUM

    Step 3: Creating New Process.

  • Oracle Workflow Builder by Dinesh Kumar S

    Step 4: Define Process Details.

  • Oracle Workflow Builder by Dinesh Kumar S Double click the process created and a new window opens.

    Step 5: Creating functions inside root process. Below are the functions we will be using in our workflow. Function 1: Start [Oracle Standard] Function 2: End [Oracle Standard] Function 3: PO_DTLS Notification: NOTIFY_PO

  • Oracle Workflow Builder by Dinesh Kumar S Step 5.1: START (Function):

  • Oracle Workflow Builder by Dinesh Kumar S Step 5.2: END (Function):

  • Oracle Workflow Builder by Dinesh Kumar S Step 5.3: Creating Role Attribute & Roles. Step 5.3.1: Create Role Attribute

  • Oracle Workflow Builder by Dinesh Kumar S Step 5.3.2: Create Roles We can create roles in 2 methods:

    Method 1: Global Application Roles Method 2: Database Adhoc Roles Method 1: Global Application Roles

    Navigation:

    Human Resource Transaction Maintenance Global Roles

    Role Name: DEMO_ROLE4 Person: Valid users from FND_USERS table.

    Note** we will be creating Roles using oracle standard API WF_DIRECTORY.

  • Oracle Workflow Builder by Dinesh Kumar S Method 2: Database Adhoc Roles

    i. Create New Role ii. Add Users to Role iii. Using Adhoc Roles in WF Notification

    Creating New Role: Use the below API to create new Roles. Execute the below code in SQL Developer / SQL PLUS.

  • Oracle Workflow Builder by Dinesh Kumar S Role successfully created.

    Add User to Role: To add users to role use the below API.

    ROLE_NAME USERS DEMO_ROLE4 User_1 Users successfully added into the Role.

    Note** Email_Address of the User should be in CAPS.

  • Oracle Workflow Builder by Dinesh Kumar S Update User e-Mail Notification Preference: User email Notification can be updated in 2 ways.

    Method 1: Using Query. Method 2: Setting Global Preference.

    Method 1: Using Query

    Email Styles: Style Description DISABLE Disabled QUERY Do not send me mail MAILHTM2 HTML mail MAILHTML HTML mail with attachments SUMHTML HTML summary mail MAILTEXT Plain text mail MAILATTH Plain text mail with HTML attachments SUMMARY Plain text summary mail Method 2: Setting Global Preference. Responsibility: Workflow Administrator Web (New) Navigation: Workflow Administrator Web (New) Administration

  • Oracle Workflow Builder by Dinesh Kumar S Step 5.4: PO_DETAILS (Function) Create a new procedure and set the Role ATTRIBUTE with ROLE Name.

    Procedure Details: D_GETPO_DTLS

  • Oracle Workflow Builder by Dinesh Kumar S

    Note** When assigning a Procedure (or) Function to a WF Function the following parameters to be defined mandatorily [Itemtype, itemkey, actid, funcmode, resultout]

    Step 5.5: Create Message & Assign to Notification

  • Oracle Workflow Builder by Dinesh Kumar S Step 5.5.1: Create Message

  • Oracle Workflow Builder by Dinesh Kumar S Now drag & drop the attributes which will be displaying in the message.

    Use the attributes valid for that message.

  • Oracle Workflow Builder by Dinesh Kumar S Step 5.5.2: Create Notification Right Click & Select Notification.

    Note** Remember the following assignments.

    Users Roles Role Attribute Performer In Node tab the performer details should be setup. Since the roles are assigned to role attribute we will be using the same.

  • Oracle Workflow Builder by Dinesh Kumar S

  • Oracle Workflow Builder by Dinesh Kumar S Step 6: Defining Transitions [Activity Flow Arrows] Right Click the source & drag it to destination node.

    Step 7: Save the Workflow Navigation: File Save As This step is to compile the Workflow. Provide User, Password & Host string to connect to database and save the workflow.

    Now the workflow will be compiled using database connection and shows error if exists.

  • Oracle Workflow Builder by Dinesh Kumar S Step 8: Uploading/Downloading the Workflow Definitions into Oracle Apps Database Oracle Workflow .WFT files can be uploaded (or) downloaded by following two methods.

    Method 1: Standard Concurrent Program. Method 2: WFLOAD Utility

    Method 1: Standard Concurrent Program. The program should be submitted in 2 different ways.

    a) For a Stand alone version of oracle workflow builder. b) For an Oracle workflow embedded in oracle version.

    For a Stand alone version of oracle workflow builder: Please Refer: Oracle Workflow Administrator's Guide Release 2.6.3

    Part Number B10283-02 http://docs.oracle.com/cd/B13789_01/workflow.101/b10283/instal85.htm#appsload For an Oracle workflow embedded in oracle version: Please Refer: Oracle Workflow Administrator's Guide Release 2.6.3

    Part Number B10283-02 http://docs.oracle.com/cd/B13789_01/workflow.101/b10283/instal85.htm#appsload

    We will be using For an Oracle workflow embedded in oracle version in our case. (Below Notes are with reference to the above said oracle administrator guide for reference.)

  • Oracle Workflow Builder by Dinesh Kumar S For an Oracle workflow embedded in oracle version:

    1) Navigate to the Submit Requests form in Oracle Applications to submit the Workflow Definitions Loader

    concurrent program. When you install and set up Oracle Applications 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. See: Overview of Concurrent Programs and Requests, Oracle Applications System Administrator's Guide.

    2) Submit the Workflow Definitions Loader concurrent program as a request. See: Submitting a Request,

    Oracle Applications User's Guide.

    3) In the Parameters window, enter values for the following parameters: Fields Parameter Type Description Mode Download Specify "Download" to download a process definition from the database to a flat

    file. Upgrade Specify "Upgrade" to apply a seed data upgrade to a database from an input file.

    The Workflow Definitions Loader assumes the access level of the file's creator (seed data provider) and overwrites any objects protected at a level equal to or above the upgrade file's access level. The Loader program preserves any customizations made to customizable seed data in the database.

    Upload Specify "Upload" to load a process definition from a flat file into the database. The upload mode is useful to someone who is developing a workflow process. It allows the developer to save definitions to the database without concern that accidental customizations to existing objects might prevent the upload of some process definition elements. The Workflow Definitions Loader uses the access level defined by the input file to upload the process definitions from the file and therefore will overwrite objects in the database that are protected at a level equal to or higher than that file's access level.

    Force Specify "Force" to force an upload of the process definitions from an input file to a database regardless of an object's protection level You should be certain that the process definition in the file is correct as it overwrites the entire process stored in the database. The Force mode is useful for fixing data integrity problems in a database with a known, reliable file backup.

    File -- Specify the full path and name of the file that you want to download a process definition to, or upgrade or upload a process definition from.

    Item Type -- If you set Mode to "Download", use the List button to choose the item type for the process definition you want to download.

  • Oracle Workflow Builder by Dinesh Kumar S Method 2: WFLOAD Utility.

    An inbuilt Oracle utility helps to save (or) Load Process Definitions from a database or flat file.

    Upload/Download/Upgrade the .WFT files into the oracle database. Syntax for UPLOAD: WFLOAD @ 0 Y {UPLOAD | UPGRADE | FORCE} [] Upload Modes Description UPGRADE Honors both protection and customization levels of data UPLOAD Honors only protection level of data [No respect of Customization Level] FORCE Force upload regardless of protection or customization level Example:

    WFLOAD apps/pwd@ 0 Y UPLOAD DEMO1.wft Syntax for DOWNLAOD: WFLOAD /@db 0 Y DOWNLOAD file_name.wft The access levels are defined as follows:

    0-9 : Reserved for Oracle Workflow 10-19 : Reserved for Oracle Application Object Library 20-99 : Reserved for Oracle E-Business Suite 100-999 : Reserved for customer organizations 1000 : Public

    SUMMARY: To upgrade - WFLOAD apps/pwd 0 Y UPGRADE filename.wft To upload - WFLOAD apps/pwd 0 Y UPLOAD filename.wft To force - WFLOAD apps/pwd 0 Y FORCE filename.wft To download - WFLOAD apps/pwd 0 Y DOWNLOAD filename.wft ITEMTYPE1

  • Oracle Workflow Builder by Dinesh Kumar S Step 8.1: First upload the .WFT file to the Custom (or) Standard Application.

    UNIX Path: /PO/11.5.0/admin/import/

    Step 8.2: Submit the Request Workflow Definition Loader Log into System Administrator responsibility to submit the request. Request Name Workflow Definition Loader Parameters Mode Upload File The path in which the file is stored in Custom/Standard Schema. Item Type Not Required for upload.

    Request executed successfully.

  • Oracle Workflow Builder by Dinesh Kumar S

    Now you can check the whether the item type is uploaded into database or not. Submit the same request & in parameter window try to select the Item_type if it is populated in LOV the WF definitions is successfully loaded into database.

  • Oracle Workflow Builder by Dinesh Kumar S Step 9: Launch the Workflow. A workflow can be launched using WF_ENGINE API by two methods,

    1) Method 1: LaunchProcess API 2) Method 2: StartProcess API

    Common Parameters Used: Parameter Name Description ItemType Internal Name of the Item type in workflow. ItemKey Unique identifier of specific workflow instance. Process Internal Name of process where workflow should begin

    ProcessName Activity Name of process. note: Top/Root process activity name = Internal Name

    Aname Internal Name of Process attribute UserKey Data End User would use to identify workflow instance

    Owner Role Display Name (from WF_LOCAL_ROLES) Useful API Information - Summary:

    Workflow API's in Starting a WF Process API Name Procedure/Function Description

    WF_ENGINE

    LaunchProcess Launching a WF from its root process. CreateProcess Creates a new runtime process for Item_type StartProcess For executing a specific Process/Sub-process within a WF. SetItemOwner Setting Workflow Item Owner. SetItemUserKey Setting the Usekey for the WF. SetItemParent If we want to initiate a sub-process from another WF this API can be

    used. GetItemUserKey Returns user identifier assigned to an item. Event Receives an event into WF Process from Business Event sys. Background To process deferred & timed out activities stuck in a process. CreateForkProces Creating a new process which is copy of original. StartForkProcess Begins execution of new fork process.

    Workflow API's to Set & Get Attribute Information API Name Procedure/Function Description

  • Oracle Workflow Builder by Dinesh Kumar S

    WF_ENGINE

    SetItemAttrText To initialize or set value for WF Process Attribute types [text, number, Date & Event] this API are used

    SetItemAttrNumber SetItemAttrDate SetItemAttrEvent SetItemAttrTextArray

    To initialize or set values for Array of Attributes these API's are used.

    SetItemAttrNumberArray SetItemAttrDateArray GetItemAttrText

    To retrieve attribute values & use it in PLSQL procedures (or) functions these API are used.

    GetItemAttrNumber GetItemAttrDate GetItemAttrEvent GetItemAttrInfo Returns property information for an item Attribute like Data

    Type, Format etc. AddItemAttr To add a new Attribute to a WF Item Type runtime process. GetActivityAttrInfo Returns property information for an activity Attribute like Data

    Type, Format etc. AddItemAttrTextArray

    To add a array of new Attributes to a WF Item Type runtime process.

    AddItemAttrNumberArray AddItemAttrDateArray GetActivityAttrTex

    Returns value of an activity attribute in a process. GetActivityAttrNumber GetActivityAttrDate GetActivityAttrEvent

  • Oracle Workflow Builder by Dinesh Kumar S

    Workflow API's to know Status of WF to WF Engine API Name Procedure/Function Description

    WF_ENGINE

    CompleteActivity Informs WF engine a specific activity[identify by node name] is completed for item.

    CompleteActivityInternalName Informs WF engine a specific activity[identify by internal name] is completed for item.

    BeginActivity To perform an activity & raises an exception if it is not.

    AssignActivity Assigning activity to a performer. GetActivityLabel Returns the label info. An activity by

    activity instance identification. AbortProcess It aborts a process executing & its related

    notifications. SuspendProcess Suspends a process so that user cannot

    transition current items to any other activity.

    ResumeProcess Re-executes a suspended process. HandleError Error Handling tasks for an Activity. Also

    used for rollback operation for a process in an activity.

    ItemStatus returns the status for a root process of specific item instance.

  • Oracle Workflow Builder by Dinesh Kumar S Launching Workflow: (Cont.. Step 9) Method 1: LaunchProcess API

    Parameter information: itemtype - A valid item type itemkey - A string generated from the application object's primary key. process - A valid root process for this item type (Or null to use the item's selector function) userkey - User key to be set owner - Role designated as owner of the item Method 2: CreateProcess + StartProcess API The following steps to be followed in coding,

    1) Create a workflow Process Instance. 2) Set the UserKey for the WF. 3) Set the workflow Item Owner. 4) Set initial values for Process Attributes. 5) Kick-Off the Workflow.

    Important Question: Why we have two methods to launch a workflow from PLSQL procedure? Method 1 will be used when we are going to kick a WF from its ROOT / TOP Process [One scenario for understanding]. Method 2 will be used when we want to want to initiate a sub-Process within an item type of from another item type this method will be used. [One scenario for understanding] For Knowledge base we will go with method 2.

  • Oracle Workflow Builder by Dinesh Kumar S

    Step 10: Run the Procedure to Kick-off the workflow.

  • Oracle Workflow Builder by Dinesh Kumar S

    Checking the status of Workflow:

  • Oracle Workflow Builder by Dinesh Kumar S Step 11: Check Notification in WF Notification Monitor. Log into Responsibility Workflow Administrator Web (New).

    Go to Home. You can view the notification.

  • Oracle Workflow Builder by Dinesh Kumar S Notification:

    Worklist:

  • Oracle Workflow Builder by Dinesh Kumar S Workflow Status Monitor:

  • Oracle Workflow Builder by Dinesh Kumar S Status Diagram:

    Activity History:

  • Oracle Workflow Builder by Dinesh Kumar S

    Sample Workflow 2

    Description: - Send PO Details to user [Role]. . - Standard Lookup_Type usage for a function.

    Note** We will be Modifying the existing Workflow File and update the same package. But pls. change the Package Name, WF objects name.

  • Oracle Workflow Builder by Dinesh Kumar S Follow the same steps from Step 1 to Step 5.3 from Sample workflow 1. Step 5.4: PO_DETAILS (Function) Create a new procedure and set the Role ATTRIBUTE with ROLE Name.

    Procedure Details: D_GETPO_DTLS Add the below code in the existing package.

    Note** two methods you can set result out. Method 1: Using wf_engine.eng_completed Method 2: Above method.

  • Oracle Workflow Builder by Dinesh Kumar S

    Follow Step 5.5 from Sample workflow-1 to define Message & notification. Step 6: Defining Transitions [Activity Flow Arrows] Right Click the source & drag it to destination node.

    While defining transition from node PO_DTLS to NOTIFY_PO we need to select Lookup_type code, based on that next activity will be performed.

    Note** If you have any default (or) any activity to perform we can use even (or) transition.

  • Oracle Workflow Builder by Dinesh Kumar S

    Similarly create transition for lookup_code NO.

    Note** If a lookup_type for example Lookup_type: PO_STATUS_TYPE Lookup_code:

    Approved Rejected Incomplete

    Follow Step 7 to Step 10 from sample workflow-1 to save, load definitions, launch and kick-off workflow.

  • Oracle Workflow Builder by Dinesh Kumar S

    Sample Workflow 3

    Description: - Using Standard Lookup Type for END activity. - Using NOOP Activity.

    Note** We will be Modifying the existing Workflow File and update the same package. But pls. change the Package Name, WF objects name.

  • Oracle Workflow Builder by Dinesh Kumar S

    Noop Activity

    The NOOP activity acts as a place holder activity that performs no action. You can use this activity anywhere you want to place a node without performing an action. You can change the display name of this activity to something meaningful when you include it in a process, so that it reminds you of what you want this activity to do in the future. This activity calls the PL/SQL procedure named WF_STANDARD.NOOP. Refer: http://docs.oracle.com/cd/B19306_01/workflow.102/b15853/T361836T362090.htm#I_sanoop Note** END Activity can be associated with Lookup Type only when the Process in which the end activity belongs should also have result type set with standard or custom Lookup type. To do this workflow, the following changes to be done in the existing workflow.

    1) Creating a Root Process. 2) Creating a NOOP Activity.

  • Oracle Workflow Builder by Dinesh Kumar S Create Workflow as below.

    Now the ROOT_PROCESS have the sub-process PO_DETAILS6.

  • Oracle Workflow Builder by Dinesh Kumar S Properties of Sub-Process PO_DETAILS6.

    Inside Sub Process:

  • Oracle Workflow Builder by Dinesh Kumar S Since, Sub-Process PO_DETAILS6 associated with Standard Lookup Type Success/Fail. In the END Activity by default the same lookup Type codes will be populated.

    Creating NOOP: Right Click New Function

    Now Follow Step 7 to Step 10 from Sample Workflow 1 to Save, Load Definitions & launch the WF.

  • Oracle Workflow Builder by Dinesh Kumar S

    Sample Workflow 4

    Description: - Using Standard Lookup Type for END activity. - Using NOOP Activity. - Using AND Activity. - Checking PO Created using Requisition or Directly Created.

    Note** We will be Modifying the existing Workflow File and update the same package. But pls. change the Package Name, WF objects name.

  • Oracle Workflow Builder by Dinesh Kumar S Since we have updated the existing workflow we will not be seeing only the changes. Process Objects:

    Object Type

    Object Name Description

    Process ROOT_PROCESS2 Top/Root Process PO_DETAILS7 Sub process inside top process. Attributes WF_ITEMTYPE Holds Item Type Name WF_ITEMKEY Holds Item Key Data ASSIGN_ROLE7 Role Attribute to hold role data PO_NUMS7 PO Number ORG_NUM7 Organization Number Notification NOTIFY_PO7 Send Notification to users in

    ASSIGN_ROLE7. Message NOTIFY_PO7 Contains Message Template/Body.

    Message Attributes: PO_NUMS7 ORG_NUM7

    ROOT_PROCESS2:

  • Oracle Workflow Builder by Dinesh Kumar S

    PO_DETAILS7:

    Flow Description: 1] PO_DTLS7: Checks PO is valid.

  • Oracle Workflow Builder by Dinesh Kumar S IF PO Valid THEN Send notification to User (AND) Check PO created from Requisition or Not. ELSE Performs a DUMMY Activity [NOOP] and Ends with Failure. END;

    2] CHK_REQ: Checks PO created using Requisition or without requisition. IF PO without REQ THEN

    Note** Now Both Activity [NOTIFY_PO7 & CHK_REQ] are completed so it satisfies AND Activity and Ends with Success.

    ELSE Activity Ends with Failure. END;

  • Oracle Workflow Builder by Dinesh Kumar S PO_DTLS7:

    NOTIFY_PO7:

  • Oracle Workflow Builder by Dinesh Kumar S

    CHK_REQ:

  • Oracle Workflow Builder by Dinesh Kumar S Standard Activities: NOOP:

    AND:

  • Oracle Workflow Builder by Dinesh Kumar S

    Sample Workflow 5(a)

    Description: - Notification Timeout functionality

    Note** We will be Modifying the existing Workflow File (Exercise 1) and update the same package. But pls. change the Package Name, WF objects name.

  • Oracle Workflow Builder by Dinesh Kumar S Notification Timeout Functionality: We can set a timeout to a WF notification at Notification properties. Along with timeout functionality if case of any business requirement we can enable reminder notification to the user. Even after sending reminder notification if the user didnt approve, it can be escalated to its supervisor. We are going to use the existing sample workflow 1 for modifying the notification timeout property.

    Double Click NOTIFY_PO. Go to Node Tab.

    Timeout Types:

  • Oracle Workflow Builder by Dinesh Kumar S There are 3 types available,

    1. No Timeout 2. Item Attribute 3. Relative Time

    No Timeout: Choose No Timeout if the activity does not have to be completed by a given time.

    Item Attribute: Choose Item Attribute if you want the activity to be completed by some relative time that is computed dynamically at runtime. Note that you must first create an item attribute of type number to store the computed timeout value and reference that predefined item attribute here.

    Note** the dynamic timeout value stored in this attribute is interpreted as a relative offset from the begin date of the activity, in the unit of MINUTES. A null timeout value or a value of zero means no timeout.

    Relative time: Choose Relative Time if you want the activity to be completed by some constant relative time. You can enter any combination of days, hours and minutes to specify when the activity times out. The value you enter is interpreted as a relative offset from the begin date of the activity, in the unit of MINUTES. A relative timeout value of zero means no timeout.

  • Oracle Workflow Builder by Dinesh Kumar S Priority type: For a notification activity node, or for an event activity node with an event action of Send, you can override the priority assigned to the activitys message. There are 3 types,

    1. Default 2. Item Attribute 3. Constant

    Default: Choose Default to keep the default priority of the message.

    Item Attribute: Choose Item Attribute to override the default priority with a new priority level that is dynamically determined at runtime. Note that you must first create an item attribute of type number to store the Computed priority value and reference that predefined item attribute here.

    Constant: Choose Constant to override the default priority with the new specified priority level.

  • Oracle Workflow Builder by Dinesh Kumar S

    Sample Workflow 5(b)

    Description: - Create Custom Result Type in a Notification

    Note** We will be modifying the same Workflow File used in 5(a).

  • Oracle Workflow Builder by Dinesh Kumar S Create New Lookup Type:

  • Oracle Workflow Builder by Dinesh Kumar S Create Lookup codes for the custom lookup type.

  • Oracle Workflow Builder by Dinesh Kumar S Similarly create another lookup code.

    Now assign this lookup code to Notification Result type.

    Note** when you open the workflow notification the below two custom action buttons will be displayed.

    OK_BUDDY NO_BUDDY

  • Oracle Workflow Builder by Dinesh Kumar S

    Sample Workflow 6

    Description: - Create Business Events Note** The event will be raised from Standard Apps Screen.

  • Oracle Workflow Builder by Dinesh Kumar S Business Event System: The Oracle Workflow Business Event System is an application service that leverages the Oracle Advanced Queuing (AQ) infrastructure to communicate business events between systems. The Business Event System consists of,

    Event Manager Workflow process event activities.

    Event Manager:

    o The Event Manager contains a registry of business events, systems, named communication agents within those systems, and subscriptions indicating that an event is significant to a particular system. Events can be raised locally or received from an external system or the local system through AQ.

    o When a local event occurs, the subscribing code is executed in the same transaction as the code that raised the

    event, unless the subscriptions are deferred.

    Subscriptions can include the following types of processing:

    Executing custom code on the event information Sending event information to a workflow process Sending event information to other queues or systems

    Event Activities:

    o Business events are represented within workflow processes by event activities. By including event activities in a workflow process, you can model complex processing or routing logic for business events beyond the options of directly running a predefined function or sending the event to a predefined recipient.

    The Business Event System supports the following types of integration:

    message-based point-to-point system integration system integration messaging hubs distributed applications messaging

  • Oracle Workflow Builder by Dinesh Kumar S

    Steps to Create Business Events:

    Step 1: Create Table

  • Oracle Workflow Builder by Dinesh Kumar S

    Step 2: Create a Package/Procedure/function to insert the data captured when business event is triggered.

    Note** for this example Im creating a global function in APPS Schema.

    Step 3: Create Business Event

  • Oracle Workflow Builder by Dinesh Kumar S Log into responsibility Workflow Administrator and go to Business Events tab.

  • Oracle Workflow Builder by Dinesh Kumar S Now click Apply and confirmation message will be displayed.

    Step 4: Create Subscription

  • Oracle Workflow Builder by Dinesh Kumar S

    Now enter Action Type. Click the LOV.

  • Oracle Workflow Builder by Dinesh Kumar S

    Click Next and enter the PL/SQL function name details.

  • Oracle Workflow Builder by Dinesh Kumar S

    Click Apply and confirmation message will be displayed.

    Step 5: Test the Business Event

    Query for the Business event.

  • Oracle Workflow Builder by Dinesh Kumar S

    Event has been raised successfully.

    Step 6: Query for the table.