oracle workflow tutorial ppt

  • 446 views
Uploaded on

oracle workflow tutorial ppt

oracle workflow tutorial ppt

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
446
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
19
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Item Type Selector Function
    For example, if an item type had two different requisition approval process activities, then the process executed by Oracle Workflow may be dependent on where the requisition originates. A selector function would determine which process would be appropriate in any given situation.
  • Standard API for Selector/Callback Function
    procedure <procedure name>(
    itemtype in varchar2,
    itemkey in varchar2,
    actid in number,
    command in varchar2,
    resultout out varchar2) is
    <local declarations>beginif (command = ‘RUN’) then<your RUN executable statements>resultout:=‘<Name of process to run>‘;return;
    endif;
    if (command = ‘SET_CTX’) then<your executable statements for establishing context information>resultout:=‘ ‘;return;
    endif;
    if (command = ‘TEST_CTX’) then<your executable statements for testing validity of current context information>resultout:=‘<TRUE or FALSE>‘;return;
    endif;
    if (command = ‘<other commands>’) thenresultout:=‘ ‘;return;
    endif;
    exceptionwhen others thenWF_CORE.CONTEXT (‘<package name>‘, ‘
    <procedure name>‘, <itemtype>, <itemkey>, to_char(<actid>), <command>);raise;
    end <procedure name>;
  • Return Values from Commands
    If the function is called with ‘RUN’, the name of the process to run must be returned through the resultout parameter.
    If the function is called with ‘SET_CTX’, then no return value is expected.
    If the function is called with ‘TEST_CTX’, then the code must return ‘TRUE’ if the context is correct or ‘FALSE’ if the context is incorrect.
    If any other value is returned, Oracle Workflow assumes the command is not implemented by the callback.
    Note: Other commands may be added in the future.
  • To Create a Self <Timeout> Loop
    To create a <Timeout> transition from the Vacation Proposal notification node back to itself, select the Vacation Proposal notification node and, holding down your right mouse button, drag your mouse away from the node and back again. Release your right mouse button. Select <Timeout> from the Results menu.
  • Setting Resultout Parameter
    Parameter resultout should be set to the internal name of the process to be started.
    Note:
    The selector procedure example given is contrived for class purposes only and does not reflect a practical implementation of selector function logic. The selector function is generally expected to use the item key as the primary key to retrieve supporting applications data. The application data retrieved would then be used to determine which process is appropriate to run.
    It is not possible to use the value of an item attribute in the selector function because at the time the selector function is called by the Workflow Engine the item attributes for the work item have not yet been created.
  • To Run the Selector Function
    The Workflow Engine will run the selector function only if the process parameter is not passed in the call to create the new process instance. So, when you initiate a workflow from the Initiate Workflow web page you must select <None> from the Process Name poplist.
  • Note:
    After starting a process from the Initiate Workflow web page, control is passed to the Monitor Activities List web page.
    You can also retrieve the process status by using the Find Processes web page or by running the developer sql script wfstat.sql <itemtype> <itemkey> in a sql*plus session. For the standalone version of Oracle Workflow, this script, and other administrative scripts, are located on your server in the Oracle Workflow admin/sql subdirectory. For the version of Oracle Workflow embedded in Oracle Applications, the scripts are located in the sql subdirectory under $FND_TOP.
  • Sample Solutions
    Refer to PL/SQL package specification and body definition files wfvacxxs.sql and wfvacxxb.sql and workflow definition file wfvacxx_141.wft for sample solutions.
    The wfvacxxs.sql and wfvacxxb.sql files contain all PL/SQL sample procedures used throughout the lesson practices. The procedure specific to Practice 14-1 is WFVACXX.SELECTOR.

Transcript

  • 1. Copyright © Oracle Corporation, 2000. All rights reserved. ® Selector Functions
  • 2. Copyright © Oracle Corporation, 2000. All rights reserved. ® Objectives After this lesson you should be able to: • Create a standard API for a selector/callback function • Define a selector/callback function • Call a selector/callback function
  • 3. Copyright © Oracle Corporation, 2000. All rights reserved. ® Item Type Selector Function • An item type can have more than one runnable process activity associated with it. • PL/SQL selector functions are defined to determine which process activity to run in a particular situation. • Selector functions can be extended to be a general callback function so that item type context information can be reset as needed if the SQL session is interrupted. • Associate a Selector Function with an Item Type through the item type properties.
  • 4. Copyright © Oracle Corporation, 2000. All rights reserved. ® Standard API for the Selector/Callback Function • You can define one PL/SQL procedure that includes both selector and callback functionality by following a standard API. procedure <procedure name> (itemtype in varchar2, itemkey in varchar2, actid in number, command in varchar2, resultout out varchar2) procedure <procedure name> (itemtype in varchar2, itemkey in varchar2, actid in number, command in varchar2, resultout out varchar2)
  • 5. Copyright © Oracle Corporation, 2000. All rights reserved. ® Defining a Selector/Callback Function • itemtypethe internal name for the item type. Defined in the Oracle Workflow Builder. • itemkeya string that represents a primary key generated by the workflow-enabled application for the item type. The string uniquely identifies the item within an item type. • actidthe ID number of the activity that this procedure is called from. This parameter is always null if the procedure is called with the ‘RUN’ command to execute the selector function.
  • 6. Copyright © Oracle Corporation, 2000. All rights reserved. ® Defining a Selector/Callback Function (Continued) • commanddetermines how to execute the selector/callback function. • resultouta result may be returned depending on the command used to call the selector/callback function
  • 7. Copyright © Oracle Corporation, 2000. All rights reserved. ® Calling a Selector/Callback Function • RUNto select the appropriate process to start when either of the following conditions occur: – A process is not explicitly passed to WF_ENGINE.CreateProcess. – A process is implicitly started by WF_ENGINE.CompleteActivity with no prior call to WF_ENGINE.CreateProcess. • SET_CTXto establish any context information that a function activity in an item type needs to execute, before a new database session begins. • TEST_CTXto determine if the current item type context is correct before executing a function. Oracle Workflow can call the selector/callback functionOracle Workflow can call the selector/callback function with the following commands:with the following commands:
  • 8. Copyright © Oracle Corporation, 2000. All rights reserved. ® Practice Overview This practice covers the following topics: • Creating additional processes in the WFVACXX item type • Assigning a Selector function to an Item Type • Creating a Selector function to choose which process to run based on the item key value • Testing a Selector function
  • 9. Copyright © Oracle Corporation, 2000. All rights reserved. ® Guided Practice Duplicating a Process 1. In the Workflow Builder Navigator open and expand the <WFVACXX> item type: a. Drag and drop the Vacation Proposal process onto the WFVACXX item type to create a copy. When the process properties window opens, enter new internal and display names for the duplicate process. For example, WFVACXX_ ALTERNATE _PROCESS and Alternate Vacation Proposal. b. Open the Alternate Vacation Proposal process diagram. Replace the Vacation Proposal notification <Timeout> to a Loop Counter with a <Timeout> transition back to the Vacation Proposal notification.
  • 10. Copyright © Oracle Corporation, 2000. All rights reserved. ® Guided Practice Assigning a Selector Function 2. In the Workflow Builder Navigator open the properties for the <WFVACXX> item type and enter a <package.procedure> value in the Selector field. For example, WFVACXX.SELECTOR.
  • 11. Copyright © Oracle Corporation, 2000. All rights reserved. ® Guided Practice Creating a Selector Procedure 3. Use the standard API format for your PL/SQL specification and body. procedure <procedure name> (itemtype in varchar2, itemkey in varchar2, actid in number, command in varchar2, resultout in out varchar2) procedure <procedure name> (itemtype in varchar2, itemkey in varchar2, actid in number, command in varchar2, resultout in out varchar2) a. Add to your package “WFVACXX” created in practice Les 9-2. b. Give your procedure the same name assigned as the item type selector <procedure> value.
  • 12. Copyright © Oracle Corporation, 2000. All rights reserved. ® Guided Practice RUN processing 4. In your SELECTOR procedure include logic for the RUN command: a. Evaluate the value passed in the item key. If the upper case value of the first four characters is: – ‘CNTR’ return the internal name of the process with the Loop Counter Timeout implementation – ‘SELF’ return the internal name of the process with the Self Loop Timeout implementation – neither value, either raise an error or return one of the processes as the default process
  • 13. Copyright © Oracle Corporation, 2000. All rights reserved. ® Guided Practice Testing a Selector Function 5. Connect to the Oracle Workflow home page. Log on as any user with “Administrator” privileges. a. Select the Launch Processes link b. Select your Item Type link from the list c. On the Initiate Workflow page enter: – an item key to exercise your Selector logic (values prefixed with ‘CNTR’, ‘SELF’, etc.) – a unique user key – a Process Name of <None> from the poplist – a requestor and approver – a from and to date (DD-MON-RRRR)
  • 14. Copyright © Oracle Corporation, 2000. All rights reserved. ® Guided Practice Monitoring the Results 6. Display the Monitor web pages for your work item. The process run will appear in the: – Monitor Process List, Process Name column – Monitor Activities List, Parent Activity column – Monitor Diagram, Process Title and Diagram itself Verify that the expected process was run. If an error occurred in your process, use the Result Exception link in the Activities List to determine the cause.
  • 15. Copyright © Oracle Corporation, 2000. All rights reserved. ® Summary In this practice, you should have learned how to: • Write a PL/SQL procedure to select which process to run • Assign a Selector function to an item type • Cause the Workflow Engine to run a Selector function • Verify that your Selector function returns the process name expected