WFTraining

129
Oracle Workflow Release 2.6 Introduction

Transcript of WFTraining

Page 1: WFTraining

Oracle Workflow Release 2.6 Oracle Workflow Release 2.6

IntroductionIntroduction

Page 2: WFTraining

AgendaAgenda

• Overview of Oracle Workflow

• Planning and Creating a Workflow Process

• Defining Function and Process Activities

• Diagramming a Workflow Process

• Advanced Features

• Overview of Oracle Workflow

• Planning and Creating a Workflow Process

• Defining Function and Process Activities

• Diagramming a Workflow Process

• Advanced Features

Page 3: WFTraining

Oracle WorkflowOracle Workflow

• Oracle Workflow automates and streamlines business processes contained within and between enterprises:

– Add personalized trading partner rules

– Validate self-service transactions

– Achieve closed loop business intelligence

– Approve standard business documents

– Step through daily transaction flows

• Oracle Workflow automates and streamlines business processes contained within and between enterprises:

– Add personalized trading partner rules

– Validate self-service transactions

– Achieve closed loop business intelligence

– Approve standard business documents

– Step through daily transaction flows

The heart of e-business

Page 4: WFTraining

RolesUsers

Directory Services

Notification Services

Send

Respond

Forward

Cancel

Query

Oracle Workflow Enabled Application

Oracle Server

Engine

Execution

Definition

Administration

Monitoring

Query

WorkflowBuilder

WorkflowLoader

WorkflowDefinition

Files

WorkflowDevelopment

Client

OracleApplication

Serveror

WebDB

NotificationMailer

ApplicationServer

WebNotification

Worklist

WebProcessMonitor

WebAnalysis

Tools

End-UserClient

MailApplications

Workflow Architecture Workflow Architecture

Page 5: WFTraining

Oracle Workflow Features and DefinitionsOracle Workflow Features and Definitions

• Oracle Workflow Builder

• Workflow Engine

• Workflow Definitions Loader

• Notification System

• Notification Worklist

• Directory Services

• Workflow Monitor

• Oracle Workflow Builder

• Workflow Engine

• Workflow Definitions Loader

• Notification System

• Notification Worklist

• Directory Services

• Workflow Monitor

Page 6: WFTraining

Oracle Workflow BuilderOracle Workflow Builder

• Development tool for Oracle Workflow

– Used to graphically define and customize the workflow definitions

– Requires a PC running Windows 95, 98, 2000 or Windows NT

• Workflow definitions: you can save them to a database or a flat file

• There are two parts to the Workflow Builder:

– Object Navigator

– Process Diagram

• Development tool for Oracle Workflow

– Used to graphically define and customize the workflow definitions

– Requires a PC running Windows 95, 98, 2000 or Windows NT

• Workflow definitions: you can save them to a database or a flat file

• There are two parts to the Workflow Builder:

– Object Navigator

– Process Diagram

Page 7: WFTraining

Workflow Process DefinitionWorkflow Process Definition

Page 8: WFTraining

Supported Process ConstructsSupported Process Constructs

• LoopingLooping

• Results-based Results-based branchingbranching

• LoopingLooping

• Results-based Results-based branchingbranching

• Parallel flowsParallel flows

• RendezvousRendezvous

Page 9: WFTraining

Supported Process ConstructsSupported Process Constructs

• VotingVoting• VotingVoting

• TimeoutsTimeouts

– EscalationEscalation

– Automatic Automatic forwardingforwarding

• Subprocesses Subprocesses (unlimited (unlimited hierarchy)hierarchy)

Page 10: WFTraining

Workflow EngineWorkflow Engine

• Is embedded in the Oracle8i server

• Uses the process definition created with Oracle Workflow Builder to coordinate the routing of activities for the process

• Monitors the state of each activity in a workflow process

• Signals any changes in the workflow state to the engine using calls to PL/SQL or Java API’s

• Guarantees consistency between the application and the workflow state because of Oracle8i transactional integrity

• Is embedded in the Oracle8i server

• Uses the process definition created with Oracle Workflow Builder to coordinate the routing of activities for the process

• Monitors the state of each activity in a workflow process

• Signals any changes in the workflow state to the engine using calls to PL/SQL or Java API’s

• Guarantees consistency between the application and the workflow state because of Oracle8i transactional integrity

Page 11: WFTraining

Workflow Definitions LoaderWorkflow Definitions Loader

Workflow Builder

Oracle 8 or higher

Workflow Engine

Workflow Loader

Process Definitions

Workflow Loader

Process Definition

Page 12: WFTraining

Notification SystemNotification System

e.g. UNIX Sendmaile.g. UNIX Sendmailor MAPI compliantor MAPI compliant

Mail SystemMail System

Application

Notification Mailer

OracleApplications

Screens

Workflow Worklist

Workflow Engine

Notification System

Directory Services

Oracle 8 or higher

Page 13: WFTraining

Notification Worklist Web PageNotification Worklist Web Page

Page 14: WFTraining

Directory ServicesDirectory Services

• WF_USERS

– Contains information on the user names, display names for the users, their notification preference and their e-mail addresses

• WF_USER_ROLES

– Contains information on the association of the users to the roles

• WF_ROLES

– Contains information on the roles of which users can be members

• WF_USERS

– Contains information on the user names, display names for the users, their notification preference and their e-mail addresses

• WF_USER_ROLES

– Contains information on the association of the users to the roles

• WF_ROLES

– Contains information on the roles of which users can be members

Page 15: WFTraining

Oracle Workflow MonitorOracle Workflow Monitor

Page 16: WFTraining

Oracle Workflow MonitorOracle Workflow Monitor

Page 17: WFTraining

Oracle Workflow MonitorOracle Workflow Monitor

Page 18: WFTraining

Process ComponentsProcess Components

Item Type

Process

Functions Notifications Subprocesses

...

...

...Lookup Types,

Attributes,PL/SQL

Messages, Lookup Types,

Attributes,PL/SQL

Functions, Notifications,

Lookup Types

..

....

Page 19: WFTraining

Creating a New Process from Bottom UpCreating a New Process from Bottom Up

1. Define the item type of the process.

2. Define the item type attributes for the process.

3. Define lookup types and lookup codes.

4. Define messages.

5. Define message attributes.

6. Define the activities in the process as Function, Notification, or Process.

7. Diagram the relationship of the activities.

1. Define the item type of the process.

2. Define the item type attributes for the process.

3. Define lookup types and lookup codes.

4. Define messages.

5. Define message attributes.

6. Define the activities in the process as Function, Notification, or Process.

7. Diagram the relationship of the activities.

Page 20: WFTraining

Creating a New Process from Top DownCreating a New Process from Top Down

1. Use the QuickStart Wizard to create the process framework.

2. Define activities without underlying dependencies.

3. Diagram the relationship of the activities.

4. Define item type attributes for the process.

5. Define lookup types and lookup codes.

6. Define messages.

7. Define message attributes.

8. Update processes, functions, and notifications with underlying components.

1. Use the QuickStart Wizard to create the process framework.

2. Define activities without underlying dependencies.

3. Diagram the relationship of the activities.

4. Define item type attributes for the process.

5. Define lookup types and lookup codes.

6. Define messages.

7. Define message attributes.

8. Update processes, functions, and notifications with underlying components.

Page 21: WFTraining

Defining Item Types, Item Attributes, and Lookup Types

Defining Item Types, Item Attributes, and Lookup Types

Page 22: WFTraining

Create a New Workflow Process Definition

Create a New Workflow Process Definition

To create a new workflow process:To create a new workflow process:

• Define the item type of the processDefine the item type of the process

• Define item type attributes for the processDefine item type attributes for the process

• Define lookup types and lookup codesDefine lookup types and lookup codes

• Define messagesDefine messages

• Define message attributesDefine message attributes

• Define the activities in the process as Function, Define the activities in the process as Function, Notification, or ProcessNotification, or Process

• Diagram the relationship of the activitiesDiagram the relationship of the activities

To create a new workflow process:To create a new workflow process:

• Define the item type of the processDefine the item type of the process

• Define item type attributes for the processDefine item type attributes for the process

• Define lookup types and lookup codesDefine lookup types and lookup codes

• Define messagesDefine messages

• Define message attributesDefine message attributes

• Define the activities in the process as Function, Define the activities in the process as Function, Notification, or ProcessNotification, or Process

• Diagram the relationship of the activitiesDiagram the relationship of the activities

Page 23: WFTraining

Quick Start WizardQuick Start Wizard

Page 24: WFTraining

Quick Start Wizard (Continued)Quick Start Wizard (Continued)

Page 25: WFTraining

Define an Item TypeDefine an Item Type

Page 26: WFTraining

Define Item Type AttributesDefine Item Type Attributes

• What should be considered an item type attribute?

– Information required by notification messages, such as the display format of a currency value

– Information required by function activities, such as values that link back to applications data like a person_ID

– Information maintained by a workflow activity, such as activities that identify who to forward information to and from in a loop construct

• What should be considered an item type attribute?

– Information required by notification messages, such as the display format of a currency value

– Information required by function activities, such as values that link back to applications data like a person_ID

– Information maintained by a workflow activity, such as activities that identify who to forward information to and from in a loop construct

Page 27: WFTraining

Define Item Type Attributes (continued)Define Item Type Attributes (continued)

Page 28: WFTraining

Form AttributesForm Attributes

Click on form icon to launch Oracle Applications form

Page 29: WFTraining

Document AttributesDocument Attributes

• PL/SQL document: a document representing data from the database, generated from a PL/SQL procedure.

– Ideal for use when document content varies

– For example, purchase orders with variable number of lines or sales orders with variable lines, discounts, and shipping addresses

– DM document: a document managed by an external document management system

• PL/SQL document: a document representing data from the database, generated from a PL/SQL procedure.

– Ideal for use when document content varies

– For example, purchase orders with variable number of lines or sales orders with variable lines, discounts, and shipping addresses

– DM document: a document managed by an external document management system

You can specify the following types of documents in You can specify the following types of documents in the default value field: the default value field:

Page 30: WFTraining

URL AttributesURL Attributes

Page 31: WFTraining

URL AttributesURL Attributes

Click on attachment icon to launch Web browser

Page 32: WFTraining

Define Lookup TypesDefine Lookup Types

Page 33: WFTraining

Define Lookup CodesDefine Lookup Codes

Page 34: WFTraining

Practice Les 1-1 OverviewPractice Les 1-1 Overview

This practice covers the following topics:

• Using the QuickStart Wizard

• Drawing transitions

• Saving a Process

This practice covers the following topics:

• Using the QuickStart Wizard

• Drawing transitions

• Saving a Process

Page 35: WFTraining

Defining a Notification ActivityDefining a Notification Activity

Page 36: WFTraining

Workflow TermsWorkflow Terms

• Notification Activity

– A step to communicate with a human being. A notification activity sends a message to a user containing the information needed to complete the work. The notification may or may not require a response from the recipient.

• Notification Activity

– A step to communicate with a human being. A notification activity sends a message to a user containing the information needed to complete the work. The notification may or may not require a response from the recipient.

Page 37: WFTraining

Create a New Workflow Process Definition

Create a New Workflow Process Definition

To create a new workflow process:To create a new workflow process:

• Define the item type of the processDefine the item type of the process

• Define item type attributes for the processDefine item type attributes for the process

• Define lookup types and lookup codesDefine lookup types and lookup codes

• Define messagesDefine messages

• Define message attributesDefine message attributes

• Define the activities in the process as Function, Define the activities in the process as Function, Notification, or ProcessNotification, or Process

• Diagram the relationship of the activitiesDiagram the relationship of the activities

To create a new workflow process:To create a new workflow process:

• Define the item type of the processDefine the item type of the process

• Define item type attributes for the processDefine item type attributes for the process

• Define lookup types and lookup codesDefine lookup types and lookup codes

• Define messagesDefine messages

• Define message attributesDefine message attributes

• Define the activities in the process as Function, Define the activities in the process as Function, Notification, or ProcessNotification, or Process

• Diagram the relationship of the activitiesDiagram the relationship of the activities

Page 38: WFTraining

Define a MessageDefine a Message

Page 39: WFTraining

Define a MessageDefine a Message

Page 40: WFTraining

Define a Message (Continued)Define a Message (Continued)

Page 41: WFTraining

Define a Message AttributeDefine a Message Attribute

Page 42: WFTraining

Define a Respond AttributeDefine a Respond Attribute

Page 43: WFTraining

Respond Attributes in the Notifications Web Page

Respond Attributes in the Notifications Web Page

Page 44: WFTraining

Define a Notification ActivityDefine a Notification Activity

Page 45: WFTraining

Standard Voting ActivityStandard Voting Activity

Page 46: WFTraining

Define a Timeout for a NotificationDefine a Timeout for a Notification

Page 47: WFTraining

Define a Performer for a NotificationDefine a Performer for a Notification

Page 48: WFTraining

Practice Les 2-1 OverviewPractice Les 2-1 Overview

This practice covers the following topics:

• Planning a Notification Only Process

• Designing a Process Top Down

• Modifying an existing Workflow Definition

• Creating Item Attributes and Messages

• Setting Node Properties (message, performer, Start/End)

This practice covers the following topics:

• Planning a Notification Only Process

• Designing a Process Top Down

• Modifying an existing Workflow Definition

• Creating Item Attributes and Messages

• Setting Node Properties (message, performer, Start/End)

Page 49: WFTraining

Practice Les 2-2 OverviewPractice Les 2-2 Overview

This practice covers the following topics:

• Creating an HTML message body

• Modifying a message

• Modifying a notification

• Modifying a process diagram

This practice covers the following topics:

• Creating an HTML message body

• Modifying a message

• Modifying a notification

• Modifying a process diagram

Page 50: WFTraining

Overview of theWorkflow Directory Service

Overview of theWorkflow Directory Service

Page 51: WFTraining

TermsTerms

• Role

• Directory Repository

• Role

• Directory Repository

Page 52: WFTraining

Directory Service Views Directory Service Views

• WF_USERS

• WF_ROLES

• WF_USER_ROLES

• WF_USERS

• WF_ROLES

• WF_USER_ROLES

Page 53: WFTraining

WF_USERS ViewWF_USERS View

• Name: Internal name of a user

• Display Name: Display name of a user

• Description: Description of a user

• Notification Preference: A value of MAILTEXT, MAILATTH, MAILHTML, QUERY or SUMMARY to indicate how user prefers to receive notifications

• Language: NLS_LANGUAGE initialization parameter that specifies the default language-dependent behavior

• Territory: NLS_TERRITORY initialization parameter that specifies the default language-dependent date and numeric formatting used

• Name: Internal name of a user

• Display Name: Display name of a user

• Description: Description of a user

• Notification Preference: A value of MAILTEXT, MAILATTH, MAILHTML, QUERY or SUMMARY to indicate how user prefers to receive notifications

• Language: NLS_LANGUAGE initialization parameter that specifies the default language-dependent behavior

• Territory: NLS_TERRITORY initialization parameter that specifies the default language-dependent date and numeric formatting used

Columns in WF_USERS contain the following Columns in WF_USERS contain the following information:information:

Page 54: WFTraining

WF_USERS View (continued)WF_USERS View (continued)

• Email_Address: Valid email address for the user or mail distribution list

• Fax: A fax number for the user

• Orig_System: Name identifying the base tables of this view

• Orig_System_ID: Primary key that identifies this user in the base tables

• Status: ACTIVE, EXTLEAVE, INACTIVE, TMPLEAVE are the status choices

• Expiration_date: Date at which the user is no longer valid in the directory service

• Email_Address: Valid email address for the user or mail distribution list

• Fax: A fax number for the user

• Orig_System: Name identifying the base tables of this view

• Orig_System_ID: Primary key that identifies this user in the base tables

• Status: ACTIVE, EXTLEAVE, INACTIVE, TMPLEAVE are the status choices

• Expiration_date: Date at which the user is no longer valid in the directory service

Page 55: WFTraining

WF_ROLES ViewWF_ROLES View

• Name

• Display Name

• Description

• Notification Preference

• Language

• Name

• Display Name

• Description

• Notification Preference

• Language

Workflow roles can be roles, positions or Workflow roles can be roles, positions or responsibilities referenced in a directory repository. responsibilities referenced in a directory repository. The columns in WF_ROLES are similar to those inThe columns in WF_ROLES are similar to those inWF_USERS view:WF_USERS view:

Page 56: WFTraining

WF_ROLES View (continued)WF_ROLES View (continued)

• Territory

• Email_Address

• Fax

• Orig_System

• Orig_System_ID

• Expiration_date

• Territory

• Email_Address

• Fax

• Orig_System

• Orig_System_ID

• Expiration_date

Page 57: WFTraining

WF_USER_ROLES ViewWF_USER_ROLES View

• User_Name: Internal name of the user as listed in WF_USERS view

• User_Orig_System: Name assigned to the directory repository that WF_USERS is based on

• User_Orig_System_ID: Primary key that identifies this user in the user directory repository

• User_Name: Internal name of the user as listed in WF_USERS view

• User_Orig_System: Name assigned to the directory repository that WF_USERS is based on

• User_Orig_System_ID: Primary key that identifies this user in the user directory repository

WF_USER_ROLES is an intersection of the users andWF_USER_ROLES is an intersection of the users androles in WF_USER and WF_ROLES.roles in WF_USER and WF_ROLES.

Page 58: WFTraining

WF_USER_ROLES View (continued)WF_USER_ROLES View (continued)

• Role_Name: Internal name of the user as listed in WF_ROLES view

• Role_Orig_System: Name assigned to the directory repository that WF_ROLES is based on

• Role_Orig_System_ID: Primary key that identifies this role in the role directory repository

• Role_Name: Internal name of the user as listed in WF_ROLES view

• Role_Orig_System: Name assigned to the directory repository that WF_ROLES is based on

• Role_Orig_System_ID: Primary key that identifies this role in the role directory repository

Page 59: WFTraining

Oracle Workflow Local Tables Oracle Workflow Local Tables

• WF_LOCAL_USERS

• WF_LOCAL_ROLES

• WF_LOCAL_USER_ROLES

• WF_LOCAL_USERS

• WF_LOCAL_ROLES

• WF_LOCAL_USER_ROLES

Page 60: WFTraining

Implementing Global User Preferences Implementing Global User Preferences

• Interaction with Oracle Workflow

• Access to the Global Preferences Web page

• Override a default user preference

• Interaction with Oracle Workflow

• Access to the Global Preferences Web page

• Override a default user preference

Page 61: WFTraining

User Preference InformationUser Preference Information

Page 62: WFTraining

Ad Hoc Users/RolesAd Hoc Users/Roles

• You can create and manage ad hoc users and roles in a workflow process.

• Use server PL/SQL APIs to dynamically create new user and role definitions in the directory service. The new APIs store the information in the WF_LOCAL_* tables.

• The WF_USERS and WF_ROLES views use the EXPIRATION_DATE.

• WF_LOCAL_USER_ROLES keeps track of the originating system of the users and roles.

• You can create and manage ad hoc users and roles in a workflow process.

• Use server PL/SQL APIs to dynamically create new user and role definitions in the directory service. The new APIs store the information in the WF_LOCAL_* tables.

• The WF_USERS and WF_ROLES views use the EXPIRATION_DATE.

• WF_LOCAL_USER_ROLES keeps track of the originating system of the users and roles.

Page 63: WFTraining

Directory Service for Oracle ApplicationsDirectory Service for Oracle Applications

• Oracle Workflow ships a unified directory service for Oracle Applications—wfdirhrv.sql. The unified directory service maps:

– WF_USERS to Oracle HRMS employees, Oracle Application/Oracle Self-Service Application users, Oracle Receivables customer contacts and WF_LOCAL_USERS.

– WF_ROLES to users in WF_USERS, Oracle HRMS positions, Oracle Federal HR group boxes, Oracle Applications responsibilities, Oracle Engineering approval lists, and WF_LOCAL_ROLES.

• Oracle Workflow ships a unified directory service for Oracle Applications—wfdirhrv.sql. The unified directory service maps:

– WF_USERS to Oracle HRMS employees, Oracle Application/Oracle Self-Service Application users, Oracle Receivables customer contacts and WF_LOCAL_USERS.

– WF_ROLES to users in WF_USERS, Oracle HRMS positions, Oracle Federal HR group boxes, Oracle Applications responsibilities, Oracle Engineering approval lists, and WF_LOCAL_ROLES.

Page 64: WFTraining

Directory Services for Oracle Workflow Standalone Version

Directory Services for Oracle Workflow Standalone Version

• Two sample Directory Services scripts are located in the Oracle Workflow sql subdirectory:

– wfdirouv.sql maps workflow users and roles to the native users and roles defined in the Oracle RDBMS.

– wfdircsv.sql maps workflow users and roles to the users and roles stored in the Oracle Workflow local tables.

• Two sample Directory Services scripts are located in the Oracle Workflow sql subdirectory:

– wfdirouv.sql maps workflow users and roles to the native users and roles defined in the Oracle RDBMS.

– wfdircsv.sql maps workflow users and roles to the users and roles stored in the Oracle Workflow local tables.

Page 65: WFTraining

Defining Function and Process ActivitiesDefining Function and Process Activities

Page 66: WFTraining

ObjectivesObjectives

After this lesson, you should be able to:

• Define a function activity

• Define an activity attribute

• Apply the Workflow Engine APIs to your function activities

• Define a process activity

After this lesson, you should be able to:

• Define a function activity

• Define an activity attribute

• Apply the Workflow Engine APIs to your function activities

• Define a process activity

Page 67: WFTraining

Create a New Workflow Process Definition

Create a New Workflow Process Definition

To create a new workflow process:To create a new workflow process:

• Define the item type of the processDefine the item type of the process

• Define item type attributes for the processDefine item type attributes for the process

• Define lookup types and lookup codesDefine lookup types and lookup codes

• Define messagesDefine messages

• Define message attributesDefine message attributes

• Define the activities in the process as Function, Define the activities in the process as Function, Notification, or ProcessNotification, or Process

• Diagram the relationship of the activitiesDiagram the relationship of the activities

To create a new workflow process:To create a new workflow process:

• Define the item type of the processDefine the item type of the process

• Define item type attributes for the processDefine item type attributes for the process

• Define lookup types and lookup codesDefine lookup types and lookup codes

• Define messagesDefine messages

• Define message attributesDefine message attributes

• Define the activities in the process as Function, Define the activities in the process as Function, Notification, or ProcessNotification, or Process

• Diagram the relationship of the activitiesDiagram the relationship of the activities

Page 68: WFTraining

Define a Function ActivityDefine a Function Activity

Page 69: WFTraining

Assigning a Cost to a Function ActivityAssigning a Cost to a Function Activity

• Cost is entered in seconds and converted to hundredths of a second when stored in the database.

• Assign a high cost to function activities that require a large amount of processing to complete.

• If the cost of an activity exceeds the threshold cost of the Workflow Engine, the activity gets deferred by the Workflow Engine.

• A background engine set up to poll for deferred activities can execute the deferred activity at a later time.

• Cost is entered in seconds and converted to hundredths of a second when stored in the database.

• Assign a high cost to function activities that require a large amount of processing to complete.

• If the cost of an activity exceeds the threshold cost of the Workflow Engine, the activity gets deferred by the Workflow Engine.

• A background engine set up to poll for deferred activities can execute the deferred activity at a later time.

Page 70: WFTraining

Standard PL/SQL API for Calling Functions

Standard PL/SQL API for Calling Functions

• All PL/SQL stored procedures called by function activities in an Oracle Workflow process should follow the standard API format so that the Workflow Engine can properly execute the activity.

• All PL/SQL stored procedures called by function activities in an Oracle Workflow process should follow the standard API format so that the Workflow Engine can properly execute the activity.

procedure <procedure name>

(itemtype in varchar2,

itemkey in varchar2,

actid in number,

funcmode in varchar2,

resultout out varchar2)

procedure <procedure name>

(itemtype in varchar2,

itemkey in varchar2,

actid in number,

funcmode in varchar2,

resultout out varchar2)

Page 71: WFTraining

Defining a Standard FunctionDefining a Standard Function

• itemtypethe internal name for the item type. Defined in the Oracle Workflow Builder.

• itemkeya 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.

• actidthe ID number of the activity that this procedure is called from.

• funcmodedetermines the execution mode of the function procedure.

• resultouta result may be returned depending on the funcmode used to call the function.

• itemtypethe internal name for the item type. Defined in the Oracle Workflow Builder.

• itemkeya 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.

• actidthe ID number of the activity that this procedure is called from.

• funcmodedetermines the execution mode of the function procedure.

• resultouta result may be returned depending on the funcmode used to call the function.

Page 72: WFTraining

Function Activity Execution Modes Function Activity Execution Modes

• Function modes:

– RUN

– Activities that are executed for the first time

– Follows CANCEL mode on a loop reset

– CANCEL

– Activities revisited as part of a loop reset

– Activities that are part of a process that has been canceled by a call to WF_ENGINE.AbortProcess

– Activities that are part of the process stream being undone by a call to WF_ENGINE.HandleError

• Function modes:

– RUN

– Activities that are executed for the first time

– Follows CANCEL mode on a loop reset

– CANCEL

– Activities revisited as part of a loop reset

– Activities that are part of a process that has been canceled by a call to WF_ENGINE.AbortProcess

– Activities that are part of the process stream being undone by a call to WF_ENGINE.HandleError

Page 73: WFTraining

Standard PL/SQL API Result Out Standard PL/SQL API Result Out

• If a Result Type is specified in the Activities property page of the Activity in the Workflow Builder, this parameter represents the expected result returned when the procedure completes. Possible Resultout values are:

• COMPLETE:<result_code>

– WAITING

– DEFERRED:<date>

– NOTIFIED:<notification_id>:<assigned_user>

– ERROR:<error_code>

• If a Result Type is specified in the Activities property page of the Activity in the Workflow Builder, this parameter represents the expected result returned when the procedure completes. Possible Resultout values are:

• COMPLETE:<result_code>

– WAITING

– DEFERRED:<date>

– NOTIFIED:<notification_id>:<assigned_user>

– ERROR:<error_code>

Page 74: WFTraining

Notification Activities RevisitedNotification Activities Revisited

• All PL/SQL stored procedures referenced by notification activities as a post-notification function in an Oracle Workflow process should follow the standard API format so that the Workflow Engine can properly execute the activity.

• All PL/SQL stored procedures referenced by notification activities as a post-notification function in an Oracle Workflow process should follow the standard API format so that the Workflow Engine can properly execute the activity.

procedure <procedure name>

(itemtype in varchar2,

itemkey in varchar2,

actid in number,

funcmode in varchar2,

resultout out varchar2)

procedure <procedure name>

(itemtype in varchar2,

itemkey in varchar2,

actid in number,

funcmode in varchar2,

resultout out varchar2)

Page 75: WFTraining

Post-Notification Function Execution Modes

Post-Notification Function Execution Modes

• Function modes:

– RESPOND

– FORWARD

– TRANSFER

– RUN

– TIMEOUT

• Function modes:

– RESPOND

– FORWARD

– TRANSFER

– RUN

– TIMEOUT

Page 76: WFTraining

PL/SQL API Result Out for a Post-Notification Function

PL/SQL API Result Out for a Post-Notification Function

• The Resultout parameter is ignored for ‘RESPOND’, ‘FORWARD’, and ‘TRANSFER’ function modes, unless it looks like ‘ERROR%’. If you want to fail the Respond, Forward, or Transfer operation after the post-notification function has executed you can:

• return Resultout = ERROR:<error_code>

– raise an exception in your procedure

• The Resultout parameter is ignored for ‘RESPOND’, ‘FORWARD’, and ‘TRANSFER’ function modes, unless it looks like ‘ERROR%’. If you want to fail the Respond, Forward, or Transfer operation after the post-notification function has executed you can:

• return Resultout = ERROR:<error_code>

– raise an exception in your procedure

Page 77: WFTraining

Post-Notification Function Context Information

Post-Notification Function Context Information

• Reference Global WF_ENGINE variables in PL/SQL

• Global Context Information set:

– WF_ENGINE.context_nid = notification_ID

– WF_ENGINE.context_text = new recipient_roleavailable in TRANSFER or FORWARD mode

– WF_ENGINE.context_text = responderavailable in RESPOND mode

• Reference Global WF_ENGINE variables in PL/SQL

• Global Context Information set:

– WF_ENGINE.context_nid = notification_ID

– WF_ENGINE.context_text = new recipient_roleavailable in TRANSFER or FORWARD mode

– WF_ENGINE.context_text = responderavailable in RESPOND mode

Page 78: WFTraining

Exception HandlingException Handling

• Use WF_CORE APIs to raise and catch errors in your PL/SQL procedures

• Engine sets function activity status “ERROR” if:

– PL/SQL procedure raises an unhandled exception

– PL/SQL procedure returns a result beginning with “ERROR:”

• Use WF_CORE APIs to raise and catch errors in your PL/SQL procedures

• Engine sets function activity status “ERROR” if:

– PL/SQL procedure raises an unhandled exception

– PL/SQL procedure returns a result beginning with “ERROR:”

Debugging Function ActivitiesDebugging Function Activities

Page 79: WFTraining

Exception Handling ExampleException Handling Example

exception

when others then

WF_CORE.CONTEXT (‘<package name>‘,

‘<procedure name>‘, <itemtype>, <itemkey>,

to_char(<actid>), <funcmode>;

raise;

end <procedure name>

exception

when others then

WF_CORE.CONTEXT (‘<package name>‘,

‘<procedure name>‘, <itemtype>, <itemkey>,

to_char(<actid>), <funcmode>;

raise;

end <procedure name>

Page 80: WFTraining

Defining a Function Activity AttributeDefining a Function Activity Attribute

Page 81: WFTraining

Defining a Process ActivityDefining a Process Activity

Page 82: WFTraining

Defining Activity DetailsDefining Activity Details

Page 83: WFTraining

LoopingLooping

• Looping occurs when the completion of an activity causes a transition to another activity that has already been completed.

• The first activity detected as a revisited activity is also called a loop point or pivot activity.

• The Workflow Engine can handle a revisitedactivity in one of three ways:

– Ignore

– Reset

– Loop

• Looping occurs when the completion of an activity causes a transition to another activity that has already been completed.

• The first activity detected as a revisited activity is also called a loop point or pivot activity.

• The Workflow Engine can handle a revisitedactivity in one of three ways:

– Ignore

– Reset

– Loop

Page 84: WFTraining

LoopingLooping

• Non-canceling Loop can improve performance by preventing the rerun of functions in CANCEL mode.

• Non-canceling Loop can improve performance by preventing the rerun of functions in CANCEL mode.

Ignore: is for OR-typeoperations where rest of

branch is ignored.

Reset: permits resettingstatus by recalling

activitiesin CANCEL-mode.

Loop: performs loopwithout any reset.

Recommended setting.

Page 85: WFTraining

Practice Les 3-1 OverviewPractice Les 3-1 Overview

This practice covers the following topics:

• Creating a Function Activity

This practice covers the following topics:

• Creating a Function Activity

Page 86: WFTraining

Overview of the Workflow EngineOverview of the Workflow Engine

Page 87: WFTraining

ObjectivesObjectives

After this lesson, you should be able to:

• Give a general description of how the Workflow Engine manages a process

• Apply the Workflow Engine APIs to your function activities

After this lesson, you should be able to:

• Give a general description of how the Workflow Engine manages a process

• Apply the Workflow Engine APIs to your function activities

Page 88: WFTraining

Overview of the Workflow EngineOverview of the Workflow Engine

• Is implemented in server-side PL/SQL.

• Is activated whenever a call to one of its PL/SQL procedures or functions is made.

• Manages the state of activities for each process instance.

• Determines the next activity once a prerequisite activity completes.

• Executes function activities automatically.

• Calls the Notification System to send notification messages.

• Is implemented in server-side PL/SQL.

• Is activated whenever a call to one of its PL/SQL procedures or functions is made.

• Manages the state of activities for each process instance.

• Determines the next activity once a prerequisite activity completes.

• Executes function activities automatically.

• Calls the Notification System to send notification messages.

The Oracle Workflow Engine:The Oracle Workflow Engine:

Page 89: WFTraining

Overview of the Workflow Engine (Continued)

Overview of the Workflow Engine (Continued)

• Supports results-based branches, parallel branches, rendezvous, loops and subprocesses.

• Can execute activities from non-savepoint environments such as database triggers and distributed transactions. It automatically traps savepoint-not-allowed errors.

• Can defer activities too costly to execute in real time to background engines for processing.

• Maintains a history of completed activities.

• Detects error conditions and executes error processes.

• Supports results-based branches, parallel branches, rendezvous, loops and subprocesses.

• Can execute activities from non-savepoint environments such as database triggers and distributed transactions. It automatically traps savepoint-not-allowed errors.

• Can defer activities too costly to execute in real time to background engines for processing.

• Maintains a history of completed activities.

• Detects error conditions and executes error processes.

Page 90: WFTraining

Initiating a Workflow ProcessInitiating a Workflow Process

• Your application must execute a procedure that calls the following Workflow Engine APIs:

– WF_ENGINE.CreateProcess

– WF_ENGINE.StartProcess

or

– WF_ENGINE.LaunchProcess

• The procedure must identify the value of the process item type and item key for these APIs

• Your application must execute a procedure that calls the following Workflow Engine APIs:

– WF_ENGINE.CreateProcess

– WF_ENGINE.StartProcess

or

– WF_ENGINE.LaunchProcess

• The procedure must identify the value of the process item type and item key for these APIs

To start a workflow process:To start a workflow process:

Page 91: WFTraining

Workflow Engine ProcessingWorkflow Engine Processing

Upon starting a process, the Workflow Engine:

• Identifies and executes the Start activity

• Determines the next activity to transition to after completing the prerequisite activity or activities

• Drives through the process, automatically executing all function activities, until it comes to a notification or blocking activity

• Calls the Notification System to notify a recipient

• Continues driving through the process until it encounters an End activity, (once the performer completes the notification or the block activity is completed)

Upon starting a process, the Workflow Engine:

• Identifies and executes the Start activity

• Determines the next activity to transition to after completing the prerequisite activity or activities

• Drives through the process, automatically executing all function activities, until it comes to a notification or blocking activity

• Calls the Notification System to notify a recipient

• Continues driving through the process until it encounters an End activity, (once the performer completes the notification or the block activity is completed)

Page 92: WFTraining

Activity StatusesActivity Statuses

Once the Workflow Engine executes an activity, itupdates the state of the activity to one of thefollowing statuses:

• Active

• Complete

• Waiting

• Notified

• Deferred

• Error

• Suspend

Once the Workflow Engine executes an activity, itupdates the state of the activity to one of thefollowing statuses:

• Active

• Complete

• Waiting

• Notified

• Deferred

• Error

• Suspend

Page 93: WFTraining

Calling the Workflow EngineCalling the Workflow Engine

• Engine must be informed when an activity completes.

– Process, notification, and function activities automatically call WF_ENGINE.CompleteActivity( ) when they complete.

– If a notification activity requires some action to be taken in a form or Web page, then that form or Web page must call WF_ENGINE.CompleteActivity( ) when the user completes the transaction.

– If a function activity calls an external program, then code that external program to call WF_ENGINE.CompleteActivity( ) when it completes.

• Engine must be informed when an activity completes.

– Process, notification, and function activities automatically call WF_ENGINE.CompleteActivity( ) when they complete.

– If a notification activity requires some action to be taken in a form or Web page, then that form or Web page must call WF_ENGINE.CompleteActivity( ) when the user completes the transaction.

– If a function activity calls an external program, then code that external program to call WF_ENGINE.CompleteActivity( ) when it completes.

Page 94: WFTraining

Oracle Workflow APIsOracle Workflow APIs

Oracle Workflow APIs are grouped as follows:

• Engine APIs

– Starting/running a process

– Communicating attribute information

– Communicating state changes

• Core APIs: raising and catching errors

• Purge APIs: purging obsolete runtime data

• Directory APIs: communicating directory services user and role information

Oracle Workflow APIs are grouped as follows:

• Engine APIs

– Starting/running a process

– Communicating attribute information

– Communicating state changes

• Core APIs: raising and catching errors

• Purge APIs: purging obsolete runtime data

• Directory APIs: communicating directory services user and role information

Page 95: WFTraining

Oracle Workflow APIs (Continued)Oracle Workflow APIs (Continued)

• Monitor APIs: generating Workflow Monitor URLs

• Notification APIs: managing notifications

• Preference APIs: retrieving user preference information

• Queue APIs: handling workflow Advanced Queues processing

• Document Management APIs: returning URLs or javascript functions

• Views: providing public views to access workflow data

• Monitor APIs: generating Workflow Monitor URLs

• Notification APIs: managing notifications

• Preference APIs: retrieving user preference information

• Queue APIs: handling workflow Advanced Queues processing

• Document Management APIs: returning URLs or javascript functions

• Views: providing public views to access workflow data

Page 96: WFTraining

Workflow Engine APIsWorkflow Engine APIs

Use the following APIs to start or run a workflowprocess:

• WF_ENGINE.CreateProcess

• WF_ENGINE.StartProcess

• WF_ENGINE.LaunchProcess

• WF_ENGINE.SetItemOwner

• WF_ENGINE.SetItemUserKey

• WF_ENGINE.SetItemParent

• WF_ENGINE.background

Use the following APIs to start or run a workflowprocess:

• WF_ENGINE.CreateProcess

• WF_ENGINE.StartProcess

• WF_ENGINE.LaunchProcess

• WF_ENGINE.SetItemOwner

• WF_ENGINE.SetItemUserKey

• WF_ENGINE.SetItemParent

• WF_ENGINE.background

Page 97: WFTraining

Workflow Engine APIs (Continued)Workflow Engine APIs (Continued)

Use the following APIs to communicate attribute information to the Workflow Engine:

• WF_ENGINE.SetItemAttribute (3)

• WF_ENGINE.SetItemAttrDocument

• WF_ENGINE.GetItemAttribute (3)

• WF_ENGINE.GetItemAttrDocument

• WF_ENGINE.GetItemAttrInfo

Use the following APIs to communicate attribute information to the Workflow Engine:

• WF_ENGINE.SetItemAttribute (3)

• WF_ENGINE.SetItemAttrDocument

• WF_ENGINE.GetItemAttribute (3)

• WF_ENGINE.GetItemAttrDocument

• WF_ENGINE.GetItemAttrInfo

Page 98: WFTraining

Workflow Engine APIs (Continued)Workflow Engine APIs (Continued)

• WF_ENGINE.GetActivityAttribute (3)

• WF_ENGINE.AddItemAttr

• WF_ENGINE.GetItemAttrInfo

• WF_ENGINE.GetActivityAttrInfo

• WF_ENGINE.GetActivityAttribute (3)

• WF_ENGINE.AddItemAttr

• WF_ENGINE.GetItemAttrInfo

• WF_ENGINE.GetActivityAttrInfo

Page 99: WFTraining

Workflow Engine APIs (Continued)Workflow Engine APIs (Continued)

Use the following APIs to communicate state changes to the Workflow Engine:

• WF_ENGINE.CompleteActivity

• WF_ENGINE.BeginActivity

• WF_ENGINE.AssignActivity

• WF_ENGINE.GetActivityLabel

• WF_ENGINE.AbortProcess

• WF_ENGINE.SuspendProcess

Use the following APIs to communicate state changes to the Workflow Engine:

• WF_ENGINE.CompleteActivity

• WF_ENGINE.BeginActivity

• WF_ENGINE.AssignActivity

• WF_ENGINE.GetActivityLabel

• WF_ENGINE.AbortProcess

• WF_ENGINE.SuspendProcess

Page 100: WFTraining

Workflow Engine APIs (Continued)Workflow Engine APIs (Continued)

• WF_ENGINE.ResumeProcess

• WF_ENGINE.HandleError

• WF_ENGINE.ItemStatus

• WF_ENGINE.ResumeProcess

• WF_ENGINE.HandleError

• WF_ENGINE.ItemStatus

Page 101: WFTraining

Background EngineBackground Engine

The Background Engine is a PL/SQL procedure.

• The Background Engine checks for and executes any deferred or timed out activities that satisfy the arguments of the procedure at the time the procedure is invoked.

• If new activities are deferred or timed out after the initiation of the current Background Engine, the procedure will check one more time for any new activities to execute prior to ending.

• The procedure ends once all matching activities are executed.

The Background Engine is a PL/SQL procedure.

• The Background Engine checks for and executes any deferred or timed out activities that satisfy the arguments of the procedure at the time the procedure is invoked.

• If new activities are deferred or timed out after the initiation of the current Background Engine, the procedure will check one more time for any new activities to execute prior to ending.

• The procedure ends once all matching activities are executed.

Page 102: WFTraining

Background EngineBackground Engine

Background Engine APIBackground Engine API

WF_ENGINE.BACKGROUND(

itemtype in varchar2,

minthreshold in number default null,

maxthreshold in number default null,

process_deferred in boolean default TRUE,

process_timeout in boolean default TRUE);

Page 103: WFTraining

Deferred ProcessingDeferred Processing

• Set the Workflow Engine threshold cost to control which activities get deferred.

• The default threshold cost of the Workflow Engine is set to 50.

• The Workflow Engine threshold is an externalized constant.

• Add this command to a form or PL/SQL procedure to change the threshold: WF_ENGINE.THRESHOLD := n;

• Set the Workflow Engine threshold cost to control which activities get deferred.

• The default threshold cost of the Workflow Engine is set to 50.

• The Workflow Engine threshold is an externalized constant.

• Add this command to a form or PL/SQL procedure to change the threshold: WF_ENGINE.THRESHOLD := n;

Page 104: WFTraining

Timed Out Notification ActivitiesTimed Out Notification Activities

• Workflow Engine calls the Notification System to deliver the notification and marks the activity as NOTIFIED.

• The background Engine configured for timed out activities checks for Notified activities and determines whether the Notified activities have timeout values that have been exceeded.

• If the timeout value is exceeded, the Background Engine marks the activity as timed out and calls the Workflow Engine to follow the <Timeout> transition.

• Timeout values may be set to an item attribute or to a relative time in days/hours/minutes.

• Workflow Engine calls the Notification System to deliver the notification and marks the activity as NOTIFIED.

• The background Engine configured for timed out activities checks for Notified activities and determines whether the Notified activities have timeout values that have been exceeded.

• If the timeout value is exceeded, the Background Engine marks the activity as timed out and calls the Workflow Engine to follow the <Timeout> transition.

• Timeout values may be set to an item attribute or to a relative time in days/hours/minutes.

Page 105: WFTraining

Error ProcessingError Processing

If an activity error occurs the Workflow Engine:

• Rolls back to the pre-activity savepoint.

• Sets the activity to the ERROR status.

• Attempts to run an Error Process.

If an activity error occurs the Workflow Engine:

• Rolls back to the pre-activity savepoint.

• Sets the activity to the ERROR status.

• Attempts to run an Error Process.

Page 106: WFTraining

Practice Les 4-1 OverviewPractice Les 4-1 Overview

This practice covers the following topics:

• Creating a Notification Timeout

• Adding a Result Type to a process

• Adding an Error Process to a process

• Running a Background Engine against a process

This practice covers the following topics:

• Creating a Notification Timeout

• Adding a Result Type to a process

• Adding an Error Process to a process

• Running a Background Engine against a process

Page 107: WFTraining

Completing Workflow Notification Activities

Completing Workflow Notification Activities

Page 108: WFTraining

Oracle Workflow Home PageOracle Workflow Home Page

Page 109: WFTraining

Notifications WorklistNotifications Worklist

Page 110: WFTraining

Notification DetailsNotification Details

Page 111: WFTraining

User List-of-values

Delegate orTransfer

reassign options

Reassigning NotificationsReassigning Notifications

Page 112: WFTraining

Launching Oracle Application FormsLaunching Oracle Application Forms

Click on form icon to launch Oracle Applications form

Page 113: WFTraining

E-Mail NotificationE-Mail Notification

<Place screenshot here><Place screenshot here><Place screenshot here><Place screenshot here>

Automaticgeneration

ofresponsetemplate

Page 114: WFTraining

E-Mail Notification (Continued)E-Mail Notification (Continued)

Automaticgeneration

ofresponsetemplate

Page 115: WFTraining

Monitoring Workflow ProcessesMonitoring Workflow Processes

Page 116: WFTraining

Workflow MonitorWorkflow Monitor

Page 117: WFTraining

Find Processes Web PageFind Processes Web Page

Page 118: WFTraining

Reviewing the Process ListReviewing the Process List

Page 119: WFTraining

Reviewing the Notifications ListReviewing the Notifications List

Page 120: WFTraining

Filtering Activities in the Activities ListFiltering Activities in the Activities List

Page 121: WFTraining

Filtering Activities in the Activities List (Continued)

Filtering Activities in the Activities List (Continued)

Page 122: WFTraining

Child/Parent InstancesChild/Parent Instances

Page 123: WFTraining

Practice Les 5-1 OverviewPractice Les 5-1 Overview

This practice covers the following topics:

• Testing PL/SQL functions in a Workflow Process

• Responding to Notifications

• Monitoring the results of a Work Item

This practice covers the following topics:

• Testing PL/SQL functions in a Workflow Process

• Responding to Notifications

• Monitoring the results of a Work Item

Page 124: WFTraining

Practice Les 5-1 Overview (Continued)Practice Les 5-1 Overview (Continued)

Using the Vacation Proposal process created in practice Les 4-1:

• Initiate a work item

• Monitor the status of your work item using the Monitor Activities List and Diagram

• Timeout the Vacation Proposal notification

• Exercise the Schedule Update function activity logic

• Exercise Vacation Proposal post-notification function logic, if implemented

• Debug any PL/SQL errors encountered

Using the Vacation Proposal process created in practice Les 4-1:

• Initiate a work item

• Monitor the status of your work item using the Monitor Activities List and Diagram

• Timeout the Vacation Proposal notification

• Exercise the Schedule Update function activity logic

• Exercise Vacation Proposal post-notification function logic, if implemented

• Debug any PL/SQL errors encountered

Page 125: WFTraining

Process Definition RestrictionsProcess Definition Restrictions

• Limited WF_ENGINE API calls:

– CreateProcess

– StartProcess

– SetItemAttribute

– GetItemAttribute

– GetActivityAttribute

– CompleteActivity

• Limited WF_ENGINE API calls:

– CreateProcess

– StartProcess

– SetItemAttribute

– GetItemAttribute

– GetActivityAttribute

– CompleteActivity

Page 126: WFTraining

PurgePurge

Page 127: WFTraining

Purging Obsolete Workflow DataPurging Obsolete Workflow Data

• Purge APIs delete obsolete runtime data and activity versions no longer in use.

• The most commonly used WF_PURGE APIs:

– Items – purge all runtime data associated with completed items, their processes, and notifications sent by them.

– Activities – purge obsolete versions of activities that are no longer in use by any item.

– Total – purge both item data and activity data.

– AdHocDirectory - purge users and roles in the WF_LOCAL_* tables whose expiration date has elapsed and that are not referenced in any notification.

• Purge APIs delete obsolete runtime data and activity versions no longer in use.

• The most commonly used WF_PURGE APIs:

– Items – purge all runtime data associated with completed items, their processes, and notifications sent by them.

– Activities – purge obsolete versions of activities that are no longer in use by any item.

– Total – purge both item data and activity data.

– AdHocDirectory - purge users and roles in the WF_LOCAL_* tables whose expiration date has elapsed and that are not referenced in any notification.

Page 128: WFTraining

Purging Obsolete Workflow Datain Oracle Applications

Purging Obsolete Workflow Datain Oracle Applications

• Use the concurrent program Purge Obsolete Workflow Runtime Data, short name FNDWFPR.

• Systems administrator should add the concurrent program to the security group for the responsibility you wish to run this program from.

• Navigate to the Submit Request form in Oracle Applications.

• Supply the following parameters:

– Item Type

– Item Key

– Age

– Persistence Type

• Use the concurrent program Purge Obsolete Workflow Runtime Data, short name FNDWFPR.

• Systems administrator should add the concurrent program to the security group for the responsibility you wish to run this program from.

• Navigate to the Submit Request form in Oracle Applications.

• Supply the following parameters:

– Item Type

– Item Key

– Age

– Persistence Type

Page 129: WFTraining

Purging Obsolete Workflow Datain Oracle Applications (continued)Purging Obsolete Workflow Data

in Oracle Applications (continued)